diff --git a/.github/workflows/polyglot-validation/Dockerfile.java b/.github/workflows/polyglot-validation/Dockerfile.java index 911912a9ae2..b62e3d73c76 100644 --- a/.github/workflows/polyglot-validation/Dockerfile.java +++ b/.github/workflows/polyglot-validation/Dockerfile.java @@ -10,7 +10,7 @@ # # Note: Expects self-extracting binary and NuGet artifacts to be pre-downloaded to /workspace/artifacts/ # -FROM mcr.microsoft.com/devcontainers/java:17 +FROM mcr.microsoft.com/devcontainers/java:25-trixie # Ensure Yarn APT repository signing key is available (base image includes Yarn repo) RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /etc/apt/keyrings/yarn-archive-keyring.gpg > /dev/null @@ -30,7 +30,8 @@ COPY setup-local-cli.sh /scripts/setup-local-cli.sh COPY test-java.sh /scripts/test-java.sh -RUN chmod +x /scripts/setup-local-cli.sh /scripts/test-java.sh +COPY test-java-playground.sh /scripts/test-java-playground.sh +RUN chmod +x /scripts/setup-local-cli.sh /scripts/test-java.sh /scripts/test-java-playground.sh # Entrypoint: Set up Aspire CLI and run validation # Bundle extraction happens lazily on first command that needs the layout @@ -40,5 +41,6 @@ aspire --nologo config set features:experimentalPolyglot:java true --global && \ echo '' && \ echo '=== Running validation ===' && \ - /scripts/test-java.sh \ + /scripts/test-java.sh && \ + /scripts/test-java-playground.sh \ "] diff --git a/.github/workflows/polyglot-validation/test-java-playground.sh b/.github/workflows/polyglot-validation/test-java-playground.sh new file mode 100644 index 00000000000..f98571c7a9e --- /dev/null +++ b/.github/workflows/polyglot-validation/test-java-playground.sh @@ -0,0 +1,118 @@ +#!/bin/bash +# Polyglot SDK Validation - Java Playground Apps +# Iterates all Java playground apps under playground/polyglot/Java/, +# runs 'aspire restore' to regenerate the .modules/ SDK, and compiles the +# compact AppHost plus generated Java SDK sources to verify there are no +# regressions in the codegen API surface. +set -euo pipefail + +echo "=== Java Playground Codegen Validation ===" + +if ! command -v aspire &> /dev/null; then + echo "❌ Aspire CLI not found in PATH" + exit 1 +fi + +if ! command -v javac &> /dev/null; then + echo "❌ javac not found in PATH (JDK required)" + exit 1 +fi + +echo "Aspire CLI version:" +aspire --version + +echo "javac version:" +javac -version + +SCRIPT_SOURCE="${BASH_SOURCE[0]:-$0}" +SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_SOURCE")" && pwd)" +if [ -d "/workspace/playground/polyglot/Java" ]; then + PLAYGROUND_ROOT="/workspace/playground/polyglot/Java" +elif [ -d "$PWD/playground/polyglot/Java" ]; then + PLAYGROUND_ROOT="$(cd "$PWD/playground/polyglot/Java" && pwd)" +elif [ -d "$SCRIPT_DIR/../../../playground/polyglot/Java" ]; then + PLAYGROUND_ROOT="$(cd "$SCRIPT_DIR/../../../playground/polyglot/Java" && pwd)" +else + echo "❌ Cannot find playground/polyglot/Java directory" + exit 1 +fi + +echo "Playground root: $PLAYGROUND_ROOT" + +APP_DIRS=() +for integration_dir in "$PLAYGROUND_ROOT"/*/; do + if [ -f "$integration_dir/ValidationAppHost/AppHost.java" ]; then + APP_DIRS+=("$integration_dir/ValidationAppHost") + fi +done + +if [ ${#APP_DIRS[@]} -eq 0 ]; then + echo "❌ No Java playground apps found" + exit 1 +fi + +echo "Found ${#APP_DIRS[@]} Java playground apps:" +for dir in "${APP_DIRS[@]}"; do + echo " - $(basename "$(dirname "$dir")")/$(basename "$dir")" +done +echo "" + +FAILED=() +PASSED=() + +for app_dir in "${APP_DIRS[@]}"; do + app_name="$(basename "$(dirname "$app_dir")")/$(basename "$app_dir")" + echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" + echo "Testing: $app_name" + echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" + + cd "$app_dir" + + echo " → aspire restore..." + if ! aspire restore --non-interactive 2>&1; then + echo " ❌ aspire restore failed for $app_name" + FAILED+=("$app_name (aspire restore)") + continue + fi + + echo " → javac..." + build_dir="$app_dir/.java-build" + rm -rf "$build_dir" + mkdir -p "$build_dir" + + if [ ! -f ".modules/sources.txt" ]; then + echo " ❌ No generated Java source list found for $app_name" + FAILED+=("$app_name (generated sources missing)") + rm -rf "$build_dir" + continue + fi + + if ! javac --enable-preview --source 25 -d "$build_dir" @.modules/sources.txt AppHost.java 2>&1; then + echo " ❌ javac compilation failed for $app_name" + FAILED+=("$app_name (javac)") + rm -rf "$build_dir" + continue + fi + + rm -rf "$build_dir" + echo " ✅ $app_name passed" + PASSED+=("$app_name") + echo "" +done + +echo "" +echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" +echo "Results: ${#PASSED[@]} passed, ${#FAILED[@]} failed out of ${#APP_DIRS[@]} apps" +echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" + +if [ ${#FAILED[@]} -gt 0 ]; then + echo "" + echo "❌ Failed apps:" + for f in "${FAILED[@]}"; do + echo " - $f" + done + exit 1 +fi + +echo "✅ All Java playground apps validated successfully!" +exit 0 diff --git a/.github/workflows/polyglot-validation/test-java.sh b/.github/workflows/polyglot-validation/test-java.sh old mode 100755 new mode 100644 index df5d0f68cd0..66fccec5d23 --- a/.github/workflows/polyglot-validation/test-java.sh +++ b/.github/workflows/polyglot-validation/test-java.sh @@ -1,11 +1,11 @@ #!/bin/bash # Polyglot SDK Validation - Java -# This script validates the Java AppHost SDK with Redis integration -set -e +# Creates a Java AppHost via the CLI, adds Redis, and validates that +# `aspire run` can launch a Redis-backed app non-interactively. +set -euo pipefail echo "=== Java AppHost SDK Validation ===" -# Verify aspire CLI is available if ! command -v aspire &> /dev/null; then echo "❌ Aspire CLI not found in PATH" exit 1 @@ -14,16 +14,24 @@ fi echo "Aspire CLI version:" aspire --version -# Create project directory -WORK_DIR=$(mktemp -d) +WORK_DIR="$(mktemp -d)" +ASPIRE_PID="" + +cleanup() { + if [ -n "${ASPIRE_PID:-}" ]; then + kill "$ASPIRE_PID" 2>/dev/null || true + fi + rm -rf "$WORK_DIR" +} + +trap cleanup EXIT + echo "Working directory: $WORK_DIR" cd "$WORK_DIR" -# Initialize Java AppHost echo "Creating Java apphost project..." aspire init --language java --non-interactive -d -# Add Redis integration echo "Adding Redis integration..." aspire add Aspire.Hosting.Redis --non-interactive -d 2>&1 || { echo "aspire add failed, manually updating settings.json..." @@ -37,23 +45,20 @@ aspire add Aspire.Hosting.Redis --non-interactive -d 2>&1 || { fi } -# Insert Redis code into AppHost.java echo "Configuring AppHost.java with Redis..." -if grep -q "builder.build()" AppHost.java; then - sed -i '/builder.build()/i\ // Add Redis cache resource\n builder.addRedis("cache", null, null).withImageRegistry("netaspireci.azurecr.io");' AppHost.java +if grep -q "builder.build().run();" AppHost.java; then + sed -i '/builder.build().run();/i\ builder.addRedis("cache")\n .withImageRegistry("netaspireci.azurecr.io");' AppHost.java echo "✅ Redis configuration added to AppHost.java" fi echo "=== AppHost.java ===" cat AppHost.java -# Run the apphost in background echo "Starting apphost in background..." -aspire run -d > aspire.log 2>&1 & +aspire run -d --non-interactive > aspire.log 2>&1 & ASPIRE_PID=$! echo "Aspire PID: $ASPIRE_PID" -# Poll for Redis container with retries echo "Polling for Redis container..." RESULT=1 for i in {1..12}; do @@ -68,7 +73,7 @@ for i in {1..12}; do sleep 10 done -if [ $RESULT -ne 0 ]; then +if [ "$RESULT" -ne 0 ]; then echo "❌ FAILURE: Redis container not found after 2 minutes" echo "=== Docker containers ===" docker ps @@ -76,9 +81,4 @@ if [ $RESULT -ne 0 ]; then cat aspire.log || true fi -# Cleanup -echo "Stopping apphost..." -kill -9 $ASPIRE_PID 2>/dev/null || true -rm -rf "$WORK_DIR" - -exit $RESULT +exit "$RESULT" diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b2295116337..b2e93ab5021 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -218,6 +218,14 @@ jobs: name: TypeScript SDK Unit Tests uses: ./.github/workflows/typescript-sdk-tests.yml + java_sdk_tests: + name: Java SDK Unit Tests + uses: ./.github/workflows/run-tests.yml + with: + testShortName: Java SDK + testProjectPath: tests/Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.Java.Tests.csproj + extraTestArgs: --filter-not-trait "quarantined=true" --filter-not-trait "outerloop=true" + results: if: ${{ always() && github.repository_owner == 'microsoft' }} runs-on: ubuntu-latest @@ -230,6 +238,7 @@ jobs: build_cli_archive_macos, extension_tests_win, typescript_sdk_tests, + java_sdk_tests, tests_no_nugets, tests_no_nugets_overflow, tests_requires_nugets_linux, @@ -294,8 +303,9 @@ jobs: contains(needs.*.result, 'cancelled') || (github.event_name == 'pull_request' && (needs.extension_tests_win.result == 'skipped' || - needs.typescript_sdk_tests.result == 'skipped' || - needs.tests_no_nugets.result == 'skipped' || + needs.typescript_sdk_tests.result == 'skipped' || + needs.java_sdk_tests.result == 'skipped' || + needs.tests_no_nugets.result == 'skipped' || needs.tests_requires_nugets_linux.result == 'skipped' || needs.tests_requires_nugets_windows.result == 'skipped' || (fromJson(needs.setup_for_tests.outputs.tests_matrix_requires_nugets_macos).include[0] != null && @@ -304,8 +314,9 @@ jobs: needs.polyglot_validation.result == 'skipped')) || (github.event_name != 'pull_request' && (needs.extension_tests_win.result == 'skipped' || - needs.typescript_sdk_tests.result == 'skipped' || - needs.tests_no_nugets.result == 'skipped' || + needs.typescript_sdk_tests.result == 'skipped' || + needs.java_sdk_tests.result == 'skipped' || + needs.tests_no_nugets.result == 'skipped' || needs.tests_requires_nugets_linux.result == 'skipped' || needs.tests_requires_nugets_windows.result == 'skipped' || (fromJson(needs.setup_for_tests.outputs.tests_matrix_requires_nugets_macos).include[0] != null && diff --git a/.gitignore b/.gitignore index c1e15bd2e7b..8b31d5af749 100644 --- a/.gitignore +++ b/.gitignore @@ -128,6 +128,14 @@ node_modules/ target/ dependency-reduced-pom.xml +# Java AppHost build artifacts +playground/**/.java-build/ +playground/**/*.class + +# Generated Java AppHost SDK sources +/playground/JavaAppHost/.modules/ +/playground/polyglot/Java/**/ValidationAppHost/.modules/ + # Ignore cache created with the Angular CLI. .angular/ diff --git a/playground/JavaAppHost/AppHost.java b/playground/JavaAppHost/AppHost.java new file mode 100644 index 00000000000..26858b1ecb7 --- /dev/null +++ b/playground/JavaAppHost/AppHost.java @@ -0,0 +1,17 @@ +import aspire.*; + +void main(String[] args) throws Exception { + IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(args); + + NodeAppResource app = builder.addNodeApp("app", "./api", "src/index.ts"); + app.withHttpEndpoint(new WithHttpEndpointOptions().env("PORT")); + app.withExternalHttpEndpoints(); + + ViteAppResource frontend = builder.addViteApp("frontend", "./frontend"); + frontend.withReference(app); + frontend.waitFor(app); + + app.publishWithContainerFiles(frontend, "./static"); + + builder.build().run(); + } diff --git a/playground/JavaAppHost/api/package.json b/playground/JavaAppHost/api/package.json new file mode 100644 index 00000000000..4c7e48f9f3a --- /dev/null +++ b/playground/JavaAppHost/api/package.json @@ -0,0 +1,22 @@ +{ + "name": "java-apphost-api", + "private": true, + "type": "module", + "scripts": { + "start": "tsx src/index.ts" + }, + "dependencies": { + "@opentelemetry/auto-instrumentations-node": "^0.71.0", + "@opentelemetry/exporter-logs-otlp-grpc": "^0.213.0", + "@opentelemetry/exporter-metrics-otlp-grpc": "^0.213.0", + "@opentelemetry/exporter-trace-otlp-grpc": "^0.213.0", + "@opentelemetry/sdk-logs": "^0.213.0", + "@opentelemetry/sdk-metrics": "^2.6.0", + "@opentelemetry/sdk-node": "^0.213.0", + "express": "^5.1.0" + }, + "devDependencies": { + "@types/express": "^5.0.6", + "tsx": "^4.21.0" + } +} diff --git a/playground/JavaAppHost/api/src/index.ts b/playground/JavaAppHost/api/src/index.ts new file mode 100644 index 00000000000..4d2c25855e1 --- /dev/null +++ b/playground/JavaAppHost/api/src/index.ts @@ -0,0 +1,42 @@ +/** + * Import the OpenTelemetry instrumentation setup first, before any other modules. + * This ensures all subsequent imports are automatically instrumented for + * distributed tracing, metrics, and logging in the Aspire dashboard. + */ +import "./instrumentation.ts"; +import express from "express"; +import { existsSync } from "fs"; +import { join } from "path"; + +const app = express(); +const port = process.env.PORT || 5000; + +/** Returns a random 5-day weather forecast as JSON. */ +app.get("/api/weatherforecast", (_req, res) => { + const summaries = ["Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"]; + const forecasts = Array.from({ length: 5 }, (_, i) => { + const temperatureC = Math.floor(Math.random() * 75) - 20; + return { + date: new Date(Date.now() + (i + 1) * 86400000).toISOString(), + temperatureC, + temperatureF: 32 + Math.trunc(temperatureC / 0.5556), + summary: summaries[Math.floor(Math.random() * summaries.length)], + }; + }); + res.json(forecasts); +}); + +app.get("/health", (_req, res) => { + res.send("Healthy"); +}); + +// Serve static files from the "static" directory if it exists (used in publish/deploy mode +// when the frontend's build output is bundled into this container via publishWithContainerFiles) +const staticDir = join(import.meta.dirname, "..", "static"); +if (existsSync(staticDir)) { + app.use(express.static(staticDir)); +} + +app.listen(port, () => { + console.log(`API server listening on port ${port}`); +}); diff --git a/playground/JavaAppHost/api/src/instrumentation.ts b/playground/JavaAppHost/api/src/instrumentation.ts new file mode 100644 index 00000000000..e9282489cdd --- /dev/null +++ b/playground/JavaAppHost/api/src/instrumentation.ts @@ -0,0 +1,44 @@ +/** + * OpenTelemetry instrumentation for the app. + * + * When the OTEL_EXPORTER_OTLP_ENDPOINT environment variable is set (automatically + * configured by Aspire), this module initializes the OpenTelemetry Node.js SDK to + * collect and export distributed traces, metrics, and logs to the Aspire dashboard. + * + * This file must be imported before any other modules to ensure all libraries + * are automatically instrumented. + * + * @see https://opentelemetry.io/docs/languages/js/getting-started/nodejs/ + */ +import { env } from 'node:process'; +import { NodeSDK } from '@opentelemetry/sdk-node'; +import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node'; +import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-grpc'; +import { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-grpc'; +import { OTLPLogExporter } from '@opentelemetry/exporter-logs-otlp-grpc'; +import { BatchLogRecordProcessor } from '@opentelemetry/sdk-logs'; +import { PeriodicExportingMetricReader } from '@opentelemetry/sdk-metrics'; + +if (env.OTEL_EXPORTER_OTLP_ENDPOINT) { + const sdk = new NodeSDK({ + traceExporter: new OTLPTraceExporter(), + metricReader: new PeriodicExportingMetricReader({ + exporter: new OTLPMetricExporter(), + }), + logRecordProcessor: new BatchLogRecordProcessor( + new OTLPLogExporter(), + ), + instrumentations: [getNodeAutoInstrumentations()], + }); + + sdk.start().catch((error) => { + console.error('Failed to start OpenTelemetry NodeSDK:', error); + }); + + process.on('SIGTERM', () => { + sdk.shutdown().finally(() => process.exit(0)); + }); + process.on('SIGINT', () => { + sdk.shutdown().finally(() => process.exit(0)); + }); +} diff --git a/playground/JavaAppHost/api/tsconfig.json b/playground/JavaAppHost/api/tsconfig.json new file mode 100644 index 00000000000..6f1f8cb7405 --- /dev/null +++ b/playground/JavaAppHost/api/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "outDir": "./dist" + }, + "include": ["src"] +} diff --git a/playground/JavaAppHost/aspire.config.json b/playground/JavaAppHost/aspire.config.json new file mode 100644 index 00000000000..75fbd923add --- /dev/null +++ b/playground/JavaAppHost/aspire.config.json @@ -0,0 +1,29 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.JavaScript": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:17000;http://localhost:15000", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21000", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:22000" + } + }, + "http": { + "applicationUrl": "http://localhost:15000", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "http://localhost:19000", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "http://localhost:20000", + "ASPIRE_ALLOW_UNSECURED_TRANSPORT": "true" + } + } + } +} diff --git a/playground/JavaAppHost/frontend/.dockerignore b/playground/JavaAppHost/frontend/.dockerignore new file mode 100644 index 00000000000..b9470778764 --- /dev/null +++ b/playground/JavaAppHost/frontend/.dockerignore @@ -0,0 +1,2 @@ +node_modules/ +dist/ diff --git a/playground/JavaAppHost/frontend/eslint.config.js b/playground/JavaAppHost/frontend/eslint.config.js new file mode 100644 index 00000000000..2b3e6ccfb16 --- /dev/null +++ b/playground/JavaAppHost/frontend/eslint.config.js @@ -0,0 +1,28 @@ +import js from '@eslint/js'; +import globals from 'globals'; +import reactHooks from 'eslint-plugin-react-hooks'; +import reactRefresh from 'eslint-plugin-react-refresh'; +import tseslint from 'typescript-eslint'; + +export default tseslint.config( + { ignores: ['dist'] }, + { + extends: [js.configs.recommended, ...tseslint.configs.recommended], + files: ['**/*.{ts,tsx}'], + languageOptions: { + ecmaVersion: 2020, + globals: globals.browser, + }, + plugins: { + 'react-hooks': reactHooks, + 'react-refresh': reactRefresh, + }, + rules: { + ...reactHooks.configs.recommended.rules, + 'react-refresh/only-export-components': [ + 'warn', + { allowConstantExport: true }, + ], + }, + }, +); diff --git a/playground/JavaAppHost/frontend/index.html b/playground/JavaAppHost/frontend/index.html new file mode 100644 index 00000000000..472646d2e0f --- /dev/null +++ b/playground/JavaAppHost/frontend/index.html @@ -0,0 +1,13 @@ + + + + + + + Aspire Starter + + +
+ + + diff --git a/playground/JavaAppHost/frontend/package-lock.json b/playground/JavaAppHost/frontend/package-lock.json new file mode 100644 index 00000000000..cf8c8acaba1 --- /dev/null +++ b/playground/JavaAppHost/frontend/package-lock.json @@ -0,0 +1,2430 @@ +{ + "name": "frontend", + "version": "0.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "frontend", + "version": "0.0.0", + "dependencies": { + "react": "^19.2.1", + "react-dom": "^19.2.1" + }, + "devDependencies": { + "@eslint/js": "^9.39.1", + "@types/node": "^24.10.1", + "@types/react": "^19.2.7", + "@types/react-dom": "^19.2.3", + "@vitejs/plugin-react": "^6.0.0", + "eslint": "^9.39.1", + "eslint-plugin-react-hooks": "^5.2.0", + "eslint-plugin-react-refresh": "^0.4.24", + "globals": "^16.5.0", + "typescript": "~5.9.3", + "typescript-eslint": "^8.48.1", + "vite": "^8.0.0" + } + }, + "node_modules/@emnapi/core": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.9.0.tgz", + "integrity": "sha512-0DQ98G9ZQZOxfUcQn1waV2yS8aWdZ6kJMbYCJB3oUBecjWYO1fqJ+a1DRfPF3O5JEkwqwP1A9QEN/9mYm2Yd0w==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/wasi-threads": "1.2.0", + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/runtime": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.9.0.tgz", + "integrity": "sha512-QN75eB0IH2ywSpRpNddCRfQIhmJYBCJ1x5Lb3IscKAL8bMnVAKnRg8dCoXbHzVLLH7P38N2Z3mtulB7W0J0FKw==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/wasi-threads": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.0.tgz", + "integrity": "sha512-N10dEJNSsUx41Z6pZsXU8FjPjpBEplgH24sfkmITrBED1/U2Esum9F3lfLrMjKHHjmi557zQn7kR9R+XWXu5Rg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.9.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.0.tgz", + "integrity": "sha512-ayVFHdtZ+hsq1t2Dy24wCmGXGe4q9Gu3smhLYALJrr473ZH27MsnSL+LKUlimp4BWJqMDMLmPpx/Q9R3OAlL4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.2", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz", + "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/config-array": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.1.tgz", + "integrity": "sha512-aw1gNayWpdI/jSYVgzN5pL0cfzU02GT3NBpeT/DXbx1/1x7ZKxFPd9bwrzygx/qiwIQiJ1sw/zD8qY/kRvlGHA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/object-schema": "^2.1.7", + "debug": "^4.3.1", + "minimatch": "^3.1.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/config-helpers": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.4.2.tgz", + "integrity": "sha512-gBrxN88gOIf3R7ja5K9slwNayVcZgK6SOUORm2uBzTeIEfeVaIhOpCtTox3P6R7o2jLFwLFTLnC7kU/RGcYEgw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^0.17.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/core": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.17.0.tgz", + "integrity": "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.15" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.3.tgz", + "integrity": "sha512-Kr+LPIUVKz2qkx1HAMH8q1q6azbqBAsXJUxBl/ODDuVPX45Z9DfwB8tPjTi6nNZ8BuM3nbJxC5zCAg5elnBUTQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^10.0.1", + "globals": "^14.0.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.1", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/js": { + "version": "9.39.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.1.tgz", + "integrity": "sha512-S26Stp4zCy88tH94QbBv3XCuzRQiZ9yXofEILmglYTh/Ug/a9/umqvgFtYBAo3Lp0nsI/5/qH1CCrbdK3AP1Tw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" + } + }, + "node_modules/@eslint/object-schema": { + "version": "2.1.7", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.7.tgz", + "integrity": "sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/plugin-kit": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.4.1.tgz", + "integrity": "sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^0.17.0", + "levn": "^0.4.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@humanfs/core": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", + "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node": { + "version": "0.16.7", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.7.tgz", + "integrity": "sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/core": "^0.19.1", + "@humanwhocodes/retry": "^0.4.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/retry": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz", + "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@napi-rs/wasm-runtime": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.1.tgz", + "integrity": "sha512-p64ah1M1ld8xjWv3qbvFwHiFVWrq1yFvV4f7w+mzaqiR4IlSgkqhcRdHwsGgomwzBH51sRY4NEowLxnaBjcW/A==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/core": "^1.7.1", + "@emnapi/runtime": "^1.7.1", + "@tybys/wasm-util": "^0.10.1" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + } + }, + "node_modules/@oxc-project/runtime": { + "version": "0.115.0", + "resolved": "https://registry.npmjs.org/@oxc-project/runtime/-/runtime-0.115.0.tgz", + "integrity": "sha512-Rg8Wlt5dCbXhQnsXPrkOjL1DTSvXLgb2R/KYfnf1/K+R0k6UMLEmbQXPM+kwrWqSmWA2t0B1EtHy2/3zikQpvQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-project/types": { + "version": "0.115.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.115.0.tgz", + "integrity": "sha512-4n91DKnebUS4yjUHl2g3/b2T+IUdCfmoZGhmwsovZCDaJSs+QkVAM+0AqqTxHSsHfeiMuueT75cZaZcT/m0pSw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/Boshen" + } + }, + "node_modules/@rolldown/binding-android-arm64": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.0.0-rc.9.tgz", + "integrity": "sha512-lcJL0bN5hpgJfSIz/8PIf02irmyL43P+j1pTCfbD1DbLkmGRuFIA4DD3B3ZOvGqG0XiVvRznbKtN0COQVaKUTg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-arm64": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.0.0-rc.9.tgz", + "integrity": "sha512-J7Zk3kLYFsLtuH6U+F4pS2sYVzac0qkjcO5QxHS7OS7yZu2LRs+IXo+uvJ/mvpyUljDJ3LROZPoQfgBIpCMhdQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-x64": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.0.0-rc.9.tgz", + "integrity": "sha512-iwtmmghy8nhfRGeNAIltcNXzD0QMNaaA5U/NyZc1Ia4bxrzFByNMDoppoC+hl7cDiUq5/1CnFthpT9n+UtfFyg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-freebsd-x64": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.0.0-rc.9.tgz", + "integrity": "sha512-DLFYI78SCiZr5VvdEplsVC2Vx53lnA4/Ga5C65iyldMVaErr86aiqCoNBLl92PXPfDtUYjUh+xFFor40ueNs4Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm-gnueabihf": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.0.0-rc.9.tgz", + "integrity": "sha512-CsjTmTwd0Hri6iTw/DRMK7kOZ7FwAkrO4h8YWKoX/kcj833e4coqo2wzIFywtch/8Eb5enQ/lwLM7w6JX1W5RQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-gnu": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.0.0-rc.9.tgz", + "integrity": "sha512-2x9O2JbSPxpxMDhP9Z74mahAStibTlrBMW0520+epJH5sac7/LwZW5Bmg/E6CXuEF53JJFW509uP+lSedaUNxg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-musl": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.0.0-rc.9.tgz", + "integrity": "sha512-JA1QRW31ogheAIRhIg9tjMfsYbglXXYGNPLdPEYrwFxdbkQCAzvpSCSHCDWNl4hTtrol8WeboCSEpjdZK8qrCg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-ppc64-gnu": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.0.0-rc.9.tgz", + "integrity": "sha512-aOKU9dJheda8Kj8Y3w9gnt9QFOO+qKPAl8SWd7JPHP+Cu0EuDAE5wokQubLzIDQWg2myXq2XhTpOVS07qqvT+w==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-s390x-gnu": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.0.0-rc.9.tgz", + "integrity": "sha512-OalO94fqj7IWRn3VdXWty75jC5dk4C197AWEuMhIpvVv2lw9fiPhud0+bW2ctCxb3YoBZor71QHbY+9/WToadA==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-gnu": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.0.0-rc.9.tgz", + "integrity": "sha512-cVEl1vZtBsBZna3YMjGXNvnYYrOJ7RzuWvZU0ffvJUexWkukMaDuGhUXn0rjnV0ptzGVkvc+vW9Yqy6h8YX4pg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-musl": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.0.0-rc.9.tgz", + "integrity": "sha512-UzYnKCIIc4heAKgI4PZ3dfBGUZefGCJ1TPDuLHoCzgrMYPb5Rv6TLFuYtyM4rWyHM7hymNdsg5ik2C+UD9VDbA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-openharmony-arm64": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.0.0-rc.9.tgz", + "integrity": "sha512-+6zoiF+RRyf5cdlFQP7nm58mq7+/2PFaY2DNQeD4B87N36JzfF/l9mdBkkmTvSYcYPE8tMh/o3cRlsx1ldLfog==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-wasm32-wasi": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-wasm32-wasi/-/binding-wasm32-wasi-1.0.0-rc.9.tgz", + "integrity": "sha512-rgFN6sA/dyebil3YTlL2evvi/M+ivhfnyxec7AccTpRPccno/rPoNlqybEZQBkcbZu8Hy+eqNJCqfBR8P7Pg8g==", + "cpu": [ + "wasm32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@napi-rs/wasm-runtime": "^1.1.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@rolldown/binding-win32-arm64-msvc": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.0.0-rc.9.tgz", + "integrity": "sha512-lHVNUG/8nlF1IQk1C0Ci574qKYyty2goMiPlRqkC5R+3LkXDkL5Dhx8ytbxq35m+pkHVIvIxviD+TWLdfeuadA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-x64-msvc": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.0.0-rc.9.tgz", + "integrity": "sha512-G0oA4+w1iY5AGi5HcDTxWsoxF509hrFIPB2rduV5aDqS9FtDg1CAfa7V34qImbjfhIcA8C+RekocJZA96EarwQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.0.0-rc.7", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-rc.7.tgz", + "integrity": "sha512-qujRfC8sFVInYSPPMLQByRh7zhwkGFS4+tyMQ83srV1qrxL4g8E2tyxVVyxd0+8QeBM1mIk9KbWxkegRr76XzA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@tybys/wasm-util": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.1.tgz", + "integrity": "sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@types/estree": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "24.10.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.1.tgz", + "integrity": "sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "undici-types": "~7.16.0" + } + }, + "node_modules/@types/react": { + "version": "19.2.7", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.7.tgz", + "integrity": "sha512-MWtvHrGZLFttgeEj28VXHxpmwYbor/ATPYbBfSFZEIRK0ecCFLl2Qo55z52Hss+UV9CRN7trSeq1zbgx7YDWWg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "csstype": "^3.2.2" + } + }, + "node_modules/@types/react-dom": { + "version": "19.2.3", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.3.tgz", + "integrity": "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@types/react": "^19.2.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.48.1.tgz", + "integrity": "sha512-X63hI1bxl5ohelzr0LY5coufyl0LJNthld+abwxpCoo6Gq+hSqhKwci7MUWkXo67mzgUK6YFByhmaHmUcuBJmA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "8.48.1", + "@typescript-eslint/type-utils": "8.48.1", + "@typescript-eslint/utils": "8.48.1", + "@typescript-eslint/visitor-keys": "8.48.1", + "graphemer": "^1.4.0", + "ignore": "^7.0.0", + "natural-compare": "^1.4.0", + "ts-api-utils": "^2.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^8.48.1", + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", + "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.48.1.tgz", + "integrity": "sha512-PC0PDZfJg8sP7cmKe6L3QIL8GZwU5aRvUFedqSIpw3B+QjRSUZeeITC2M5XKeMXEzL6wccN196iy3JLwKNvDVA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@typescript-eslint/scope-manager": "8.48.1", + "@typescript-eslint/types": "8.48.1", + "@typescript-eslint/typescript-estree": "8.48.1", + "@typescript-eslint/visitor-keys": "8.48.1", + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/project-service": { + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.48.1.tgz", + "integrity": "sha512-HQWSicah4s9z2/HifRPQ6b6R7G+SBx64JlFQpgSSHWPKdvCZX57XCbszg/bapbRsOEv42q5tayTYcEFpACcX1w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/tsconfig-utils": "^8.48.1", + "@typescript-eslint/types": "^8.48.1", + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.48.1.tgz", + "integrity": "sha512-rj4vWQsytQbLxC5Bf4XwZ0/CKd362DkWMUkviT7DCS057SK64D5lH74sSGzhI6PDD2HCEq02xAP9cX68dYyg1w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.48.1", + "@typescript-eslint/visitor-keys": "8.48.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/tsconfig-utils": { + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.48.1.tgz", + "integrity": "sha512-k0Jhs4CpEffIBm6wPaCXBAD7jxBtrHjrSgtfCjUvPp9AZ78lXKdTR8fxyZO5y4vWNlOvYXRtngSZNSn+H53Jkw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.48.1.tgz", + "integrity": "sha512-1jEop81a3LrJQLTf/1VfPQdhIY4PlGDBc/i67EVWObrtvcziysbLN3oReexHOM6N3jyXgCrkBsZpqwH0hiDOQg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.48.1", + "@typescript-eslint/typescript-estree": "8.48.1", + "@typescript-eslint/utils": "8.48.1", + "debug": "^4.3.4", + "ts-api-utils": "^2.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.48.1.tgz", + "integrity": "sha512-+fZ3LZNeiELGmimrujsDCT4CRIbq5oXdHe7chLiW8qzqyPMnn1puNstCrMNVAqwcl2FdIxkuJ4tOs/RFDBVc/Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.48.1.tgz", + "integrity": "sha512-/9wQ4PqaefTK6POVTjJaYS0bynCgzh6ClJHGSBj06XEHjkfylzB+A3qvyaXnErEZSaxhIo4YdyBgq6j4RysxDg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/project-service": "8.48.1", + "@typescript-eslint/tsconfig-utils": "8.48.1", + "@typescript-eslint/types": "8.48.1", + "@typescript-eslint/visitor-keys": "8.48.1", + "debug": "^4.3.4", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "tinyglobby": "^0.2.15", + "ts-api-utils": "^2.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { + "version": "7.7.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", + "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.48.1.tgz", + "integrity": "sha512-fAnhLrDjiVfey5wwFRwrweyRlCmdz5ZxXz2G/4cLn0YDLjTapmN4gcCsTBR1N2rWnZSDeWpYtgLDsJt+FpmcwA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.7.0", + "@typescript-eslint/scope-manager": "8.48.1", + "@typescript-eslint/types": "8.48.1", + "@typescript-eslint/typescript-estree": "8.48.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.48.1.tgz", + "integrity": "sha512-BmxxndzEWhE4TIEEMBs8lP3MBWN3jFPs/p6gPm/wkv02o41hI6cq9AuSmGAaTTHPtA1FTi2jBre4A9rm5ZmX+Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.48.1", + "eslint-visitor-keys": "^4.2.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@vitejs/plugin-react": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-6.0.1.tgz", + "integrity": "sha512-l9X/E3cDb+xY3SWzlG1MOGt2usfEHGMNIaegaUGFsLkb3RCn/k8/TOXBcab+OndDI4TBtktT8/9BwwW8Vi9KUQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rolldown/pluginutils": "1.0.0-rc.7" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "peerDependencies": { + "@rolldown/plugin-babel": "^0.1.7 || ^0.2.0", + "babel-plugin-react-compiler": "^1.0.0", + "vite": "^8.0.0" + }, + "peerDependenciesMeta": { + "@rolldown/plugin-babel": { + "optional": true + }, + "babel-plugin-react-compiler": { + "optional": true + } + } + }, + "node_modules/acorn": { + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", + "dev": true, + "license": "MIT", + "peer": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "license": "Python-2.0" + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, + "license": "MIT" + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/csstype": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", + "dev": true, + "license": "MIT" + }, + "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/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "9.39.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.1.tgz", + "integrity": "sha512-BhHmn2yNOFA9H9JmmIVKJmd288g9hrVRDkdoIgRCRuSySRUHH7r/DI6aAXW9T1WwUuY3DFgrcaqB+deURBLR5g==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.8.0", + "@eslint-community/regexpp": "^4.12.1", + "@eslint/config-array": "^0.21.1", + "@eslint/config-helpers": "^0.4.2", + "@eslint/core": "^0.17.0", + "@eslint/eslintrc": "^3.3.1", + "@eslint/js": "9.39.1", + "@eslint/plugin-kit": "^0.4.1", + "@humanfs/node": "^0.16.6", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.4.2", + "@types/estree": "^1.0.6", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.6", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^8.4.0", + "eslint-visitor-keys": "^4.2.1", + "espree": "^10.4.0", + "esquery": "^1.5.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^8.0.0", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } + } + }, + "node_modules/eslint-plugin-react-hooks": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-5.2.0.tgz", + "integrity": "sha512-+f15FfK64YQwZdJNELETdn5ibXEUQmW1DZL6KXhNnc2heoy/sg9VJJeT7n8TlMWouzWqSWavFkIhHyIbIAEapg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0" + } + }, + "node_modules/eslint-plugin-react-refresh": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.4.24.tgz", + "integrity": "sha512-nLHIW7TEq3aLrEYWpVaJ1dRgFR+wLDPN8e8FpYAql/bMV2oBEfC37K0gLEGgv9fy66juNShSMV8OkTqzltcG/w==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "eslint": ">=8.40" + } + }, + "node_modules/eslint-scope": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz", + "integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", + "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz", + "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.15.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^4.2.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", + "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/file-entry-cache": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "flat-cache": "^4.0.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat-cache": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.4" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/flatted": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz", + "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==", + "dev": true, + "license": "ISC" + }, + "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/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/globals": { + "version": "16.5.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-16.5.0.tgz", + "integrity": "sha512-c/c15i26VrJ4IRt5Z89DnIzCGDn9EcebibhAOjw5ibqEHsE1wLUgkPn9RDmNcUKyU87GeaL633nyJ+pplFR2ZQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true, + "license": "MIT" + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, + "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/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "license": "ISC" + }, + "node_modules/js-yaml": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", + "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/lightningcss": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.32.0.tgz", + "integrity": "sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==", + "dev": true, + "license": "MPL-2.0", + "dependencies": { + "detect-libc": "^2.0.3" + }, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "optionalDependencies": { + "lightningcss-android-arm64": "1.32.0", + "lightningcss-darwin-arm64": "1.32.0", + "lightningcss-darwin-x64": "1.32.0", + "lightningcss-freebsd-x64": "1.32.0", + "lightningcss-linux-arm-gnueabihf": "1.32.0", + "lightningcss-linux-arm64-gnu": "1.32.0", + "lightningcss-linux-arm64-musl": "1.32.0", + "lightningcss-linux-x64-gnu": "1.32.0", + "lightningcss-linux-x64-musl": "1.32.0", + "lightningcss-win32-arm64-msvc": "1.32.0", + "lightningcss-win32-x64-msvc": "1.32.0" + } + }, + "node_modules/lightningcss-android-arm64": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.32.0.tgz", + "integrity": "sha512-YK7/ClTt4kAK0vo6w3X+Pnm0D2cf2vPHbhOXdoNti1Ga0al1P4TBZhwjATvjNwLEBCnKvjJc2jQgHXH0NEwlAg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-arm64": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.32.0.tgz", + "integrity": "sha512-RzeG9Ju5bag2Bv1/lwlVJvBE3q6TtXskdZLLCyfg5pt+HLz9BqlICO7LZM7VHNTTn/5PRhHFBSjk5lc4cmscPQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-x64": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.32.0.tgz", + "integrity": "sha512-U+QsBp2m/s2wqpUYT/6wnlagdZbtZdndSmut/NJqlCcMLTWp5muCrID+K5UJ6jqD2BFshejCYXniPDbNh73V8w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-freebsd-x64": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.32.0.tgz", + "integrity": "sha512-JCTigedEksZk3tHTTthnMdVfGf61Fky8Ji2E4YjUTEQX14xiy/lTzXnu1vwiZe3bYe0q+SpsSH/CTeDXK6WHig==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm-gnueabihf": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.32.0.tgz", + "integrity": "sha512-x6rnnpRa2GL0zQOkt6rts3YDPzduLpWvwAF6EMhXFVZXD4tPrBkEFqzGowzCsIWsPjqSK+tyNEODUBXeeVHSkw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-gnu": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.32.0.tgz", + "integrity": "sha512-0nnMyoyOLRJXfbMOilaSRcLH3Jw5z9HDNGfT/gwCPgaDjnx0i8w7vBzFLFR1f6CMLKF8gVbebmkUN3fa/kQJpQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-musl": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.32.0.tgz", + "integrity": "sha512-UpQkoenr4UJEzgVIYpI80lDFvRmPVg6oqboNHfoH4CQIfNA+HOrZ7Mo7KZP02dC6LjghPQJeBsvXhJod/wnIBg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-gnu": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.32.0.tgz", + "integrity": "sha512-V7Qr52IhZmdKPVr+Vtw8o+WLsQJYCTd8loIfpDaMRWGUZfBOYEJeyJIkqGIDMZPwPx24pUMfwSxxI8phr/MbOA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-musl": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.32.0.tgz", + "integrity": "sha512-bYcLp+Vb0awsiXg/80uCRezCYHNg1/l3mt0gzHnWV9XP1W5sKa5/TCdGWaR/zBM2PeF/HbsQv/j2URNOiVuxWg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-arm64-msvc": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.32.0.tgz", + "integrity": "sha512-8SbC8BR40pS6baCM8sbtYDSwEVQd4JlFTOlaD3gWGHfThTcABnNDBda6eTZeqbofalIJhFx0qKzgHJmcPTnGdw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-x64-msvc": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.32.0.tgz", + "integrity": "sha512-Amq9B/SoZYdDi1kFrojnoqPLxYhQ4Wo5XiL8EVJrVsB8ARoC1PWW6VGtT0WKCemjy8aC+louJnjS7U18x3b06Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "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/nanoid": { + "version": "3.3.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true, + "license": "MIT" + }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/postcss": { + "version": "8.5.8", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.8.tgz", + "integrity": "sha512-OW/rX8O/jXnm82Ey1k44pObPtdblfiuWnrd8X7GJ7emImCOstunGbXUpp7HdBrFQX6rJzn3sPT397Wp5aCwCHg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.11", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/react": { + "version": "19.2.1", + "resolved": "https://registry.npmjs.org/react/-/react-19.2.1.tgz", + "integrity": "sha512-DGrYcCWK7tvYMnWh79yrPHt+vdx9tY+1gPZa7nJQtO/p8bLTDaHp4dzwEhQB7pZ4Xe3ok4XKuEPrVuc+wlpkmw==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "19.2.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.1.tgz", + "integrity": "sha512-ibrK8llX2a4eOskq1mXKu/TGZj9qzomO+sNfO98M6d9zIPOEhlBkMkBUBLd1vgS0gQsLDBzA+8jJBVXDnfHmJg==", + "license": "MIT", + "dependencies": { + "scheduler": "^0.27.0" + }, + "peerDependencies": { + "react": "^19.2.1" + } + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/rolldown": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.0.0-rc.9.tgz", + "integrity": "sha512-9EbgWge7ZH+yqb4d2EnELAntgPTWbfL8ajiTW+SyhJEC4qhBbkCKbqFV4Ge4zmu5ziQuVbWxb/XwLZ+RIO7E8Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@oxc-project/types": "=0.115.0", + "@rolldown/pluginutils": "1.0.0-rc.9" + }, + "bin": { + "rolldown": "bin/cli.mjs" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "optionalDependencies": { + "@rolldown/binding-android-arm64": "1.0.0-rc.9", + "@rolldown/binding-darwin-arm64": "1.0.0-rc.9", + "@rolldown/binding-darwin-x64": "1.0.0-rc.9", + "@rolldown/binding-freebsd-x64": "1.0.0-rc.9", + "@rolldown/binding-linux-arm-gnueabihf": "1.0.0-rc.9", + "@rolldown/binding-linux-arm64-gnu": "1.0.0-rc.9", + "@rolldown/binding-linux-arm64-musl": "1.0.0-rc.9", + "@rolldown/binding-linux-ppc64-gnu": "1.0.0-rc.9", + "@rolldown/binding-linux-s390x-gnu": "1.0.0-rc.9", + "@rolldown/binding-linux-x64-gnu": "1.0.0-rc.9", + "@rolldown/binding-linux-x64-musl": "1.0.0-rc.9", + "@rolldown/binding-openharmony-arm64": "1.0.0-rc.9", + "@rolldown/binding-wasm32-wasi": "1.0.0-rc.9", + "@rolldown/binding-win32-arm64-msvc": "1.0.0-rc.9", + "@rolldown/binding-win32-x64-msvc": "1.0.0-rc.9" + } + }, + "node_modules/rolldown/node_modules/@rolldown/pluginutils": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-rc.9.tgz", + "integrity": "sha512-w6oiRWgEBl04QkFZgmW+jnU1EC9b57Oihi2ot3HNWIQRqgHp5PnYDia5iZ5FF7rpa4EQdiqMDXjlqKGXBhsoXw==", + "dev": true, + "license": "MIT" + }, + "node_modules/scheduler": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz", + "integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==", + "license": "MIT" + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.15", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", + "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.3" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/ts-api-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.1.0.tgz", + "integrity": "sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.12" + }, + "peerDependencies": { + "typescript": ">=4.8.4" + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "dev": true, + "license": "0BSD", + "optional": true + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "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", + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/typescript-eslint": { + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.48.1.tgz", + "integrity": "sha512-FbOKN1fqNoXp1hIl5KYpObVrp0mCn+CLgn479nmu2IsRMrx2vyv74MmsBLVlhg8qVwNFGbXSp8fh1zp8pEoC2A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.48.1", + "@typescript-eslint/parser": "8.48.1", + "@typescript-eslint/typescript-estree": "8.48.1", + "@typescript-eslint/utils": "8.48.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/undici-types": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", + "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", + "dev": true, + "license": "MIT" + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/vite": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/vite/-/vite-8.0.0.tgz", + "integrity": "sha512-fPGaRNj9Zytaf8LEiBhY7Z6ijnFKdzU/+mL8EFBaKr7Vw1/FWcTBAMW0wLPJAGMPX38ZPVCVgLceWiEqeoqL2Q==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@oxc-project/runtime": "0.115.0", + "lightningcss": "^1.32.0", + "picomatch": "^4.0.3", + "postcss": "^8.5.8", + "rolldown": "1.0.0-rc.9", + "tinyglobby": "^0.2.15" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "@vitejs/devtools": "^0.0.0-alpha.31", + "esbuild": "^0.27.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "@vitejs/devtools": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + } +} diff --git a/playground/JavaAppHost/frontend/package.json b/playground/JavaAppHost/frontend/package.json new file mode 100644 index 00000000000..e684fdb3139 --- /dev/null +++ b/playground/JavaAppHost/frontend/package.json @@ -0,0 +1,33 @@ +{ + "name": "frontend", + "private": true, + "version": "0.0.0", + "type": "module", + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "scripts": { + "dev": "vite", + "build": "tsc -b && vite build", + "lint": "eslint .", + "preview": "vite preview" + }, + "dependencies": { + "react": "^19.2.1", + "react-dom": "^19.2.1" + }, + "devDependencies": { + "@eslint/js": "^9.39.1", + "@types/node": "^24.10.1", + "@types/react": "^19.2.7", + "@types/react-dom": "^19.2.3", + "@vitejs/plugin-react": "^6.0.0", + "eslint": "^9.39.1", + "eslint-plugin-react-hooks": "^5.2.0", + "eslint-plugin-react-refresh": "^0.4.24", + "globals": "^16.5.0", + "typescript": "~5.9.3", + "typescript-eslint": "^8.48.1", + "vite": "^8.0.0" + } +} diff --git a/playground/JavaAppHost/frontend/public/Aspire.png b/playground/JavaAppHost/frontend/public/Aspire.png new file mode 100644 index 00000000000..d4be662a618 Binary files /dev/null and b/playground/JavaAppHost/frontend/public/Aspire.png differ diff --git a/playground/JavaAppHost/frontend/public/github.svg b/playground/JavaAppHost/frontend/public/github.svg new file mode 100644 index 00000000000..162a4a43a35 --- /dev/null +++ b/playground/JavaAppHost/frontend/public/github.svg @@ -0,0 +1,3 @@ + + + diff --git a/playground/JavaAppHost/frontend/src/App.css b/playground/JavaAppHost/frontend/src/App.css new file mode 100644 index 00000000000..1f690dea729 --- /dev/null +++ b/playground/JavaAppHost/frontend/src/App.css @@ -0,0 +1,794 @@ +/* CSS Variables for theming */ +:root { + --bg-gradient-start: #1a1a2e; + --bg-gradient-end: #16213e; + --card-bg: rgba(30, 30, 46, 0.95); + --card-hover-shadow: rgba(0, 0, 0, 0.3); + --text-primary: #ffffff; + --text-secondary: #e2e8f0; + --text-tertiary: #cbd5e0; + --accent-gradient-start: #7c92f5; + --accent-gradient-end: #8b5ecf; + --weather-card-bg: rgba(45, 45, 60, 0.8); + --weather-card-border: rgba(255, 255, 255, 0.1); + --section-title-color: #f7fafc; + --date-color: #cbd5e0; + --summary-color: #f7fafc; + --temp-unit-color: #e2e8f0; + --divider-color: #4a5568; + --error-bg: rgba(220, 38, 38, 0.1); + --error-border: #ef4444; + --error-text: #fca5a5; + --skeleton-bg-1: rgba(255, 255, 255, 0.05); + --skeleton-bg-2: rgba(255, 255, 255, 0.1); + --tile-min-height: 120px; + --tile-gap: 0.75rem; + --cta-height: 3rem; + --card-inner-gap: 1rem; + --focus-color: #a78bfa; +} + +@media (prefers-color-scheme: light) { + :root { + --bg-gradient-start: #f0f4ff; + --bg-gradient-end: #e0e7ff; + --card-bg: rgba(255, 255, 255, 0.98); + --card-hover-shadow: rgba(0, 0, 0, 0.15); + --text-primary: #1a202c; + --text-secondary: #2d3748; + --text-tertiary: #4a5568; + --accent-gradient-start: #5b6fd8; + --accent-gradient-end: #6b46a3; + --weather-card-bg: rgba(255, 255, 255, 0.9); + --weather-card-border: rgba(102, 126, 234, 0.15); + --section-title-color: #1a202c; + --date-color: #2d3748; + --summary-color: #1a202c; + --temp-unit-color: #4a5568; + --divider-color: #cbd5e0; + --error-bg: #fee; + --error-border: #dc2626; + --error-text: #991b1b; + --skeleton-bg-1: #f0f0f0; + --skeleton-bg-2: #e0e0e0; + --tile-min-height: 120px; + --tile-gap: 0.75rem; + --cta-height: 3rem; + --card-inner-gap: 1rem; + --focus-color: #5b21b6; + } +} + +/* Root container */ +#root { + width: 100%; + min-height: 100vh; + display: flex; + flex-direction: column; + overflow-x: hidden; +} + +/* Accessibility utilities */ +.visually-hidden { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border-width: 0; +} + +/* App container */ +.app-container { + width: 100%; + min-height: 100vh; + display: flex; + flex-direction: column; + background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%); + color: var(--text-primary); +} + +/* Header */ +.app-header { + padding: 2.5rem 2rem 1.5rem; + text-align: center; + animation: fadeInDown 0.6s ease-out; +} + +.logo-link { + display: inline-block; + border-radius: 0.5rem; +} + +.logo-link:focus-visible { + outline: 3px solid var(--accent-gradient-end); + outline-offset: 8px; +} + +.logo { + height: 5rem; + width: auto; + transition: transform 300ms ease, filter 300ms ease; + filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2)); +} + +.logo:hover { + transform: scale(1.1) rotate(5deg); + filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.3)); +} + +.app-title { + font-size: 2.75rem; + font-weight: 700; + margin: 1.25rem 0 0.5rem; + background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + background-clip: text; + letter-spacing: -0.02em; +} + +.app-subtitle { + font-size: 1.05rem; + color: var(--text-tertiary); + margin: 0; + font-weight: 300; +} + +/* Main content */ +.main-content { + flex: 1; + max-width: 1400px; + width: 100%; + margin: 0 auto; + padding: 0rem 2rem 2rem; + display: flex; + justify-content: center; + align-items: center; +} + +/* Card styles */ +.card { + background: var(--card-bg); + backdrop-filter: blur(10px); + border-radius: 1rem; + padding: 1.25rem 1.5rem; + box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1); + color: var(--text-primary); + animation: fadeInUp 0.6s ease-out; + border: 1px solid var(--weather-card-border); + display: flex; + flex-direction: column; + gap: var(--card-inner-gap); +} + +/* Section styles */ +.demo-section { + animation: fadeInUp 0.6s ease-out; +} + +.weather-section { + animation: fadeInUp 0.6s ease-out; + animation-delay: 0.1s; + flex: 1; + max-width: 1200px; + width: 100%; +} + +.section-header { + display: flex; + justify-content: space-between; + align-items: flex-start; + margin-bottom: 0; + flex-wrap: wrap; + gap: 1rem; +} + +.header-actions { + display: flex; + gap: 0.75rem; + align-items: center; +} + +.section-title { + font-size: 1.25rem; + font-weight: 600; + margin: 0; + color: var(--section-title-color); +} + +/* Counter area */ +.counter-card .section-header { + margin-bottom: 0; +} + +.counter-panel { + background: var(--weather-card-bg); + border-radius: 0.75rem; + border: 1px solid var(--weather-card-border); + padding: 1.25rem; + display: flex; + flex-direction: column; + gap: var(--tile-gap); + min-height: var(--tile-min-height); + backdrop-filter: blur(10px); + flex: 1; +} + +.counter-value-group { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + gap: 0.25rem; + flex: 1; + margin-bottom: var(--tile-gap); + text-align: center; +} + +.counter-label { + font-size: 0.75rem; + text-transform: uppercase; + letter-spacing: 0.1em; + color: var(--text-tertiary); + font-weight: 600; +} + +.counter-value { + font-size: 2.25rem; + font-weight: 700; + line-height: 1; + background: linear-gradient(135deg, var(--accent-gradient-start) 0%, var(--accent-gradient-end) 100%); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + background-clip: text; +} + +.increment-button { + display: flex; + align-items: center; + justify-content: center; + gap: 0.5rem; + background: linear-gradient(135deg, var(--accent-gradient-start) 0%, var(--accent-gradient-end) 100%); + color: white; + border: none; + border-radius: 0.5rem; + padding: 0 1.5rem; + height: var(--cta-height); + font-size: 0.875rem; + font-weight: 600; + cursor: pointer; + transition: all 0.3s ease; + box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3); + width: 100%; + margin-top: auto; +} + +.increment-button:hover { + transform: translateY(-1px); + box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4); +} + +.increment-button:active { + transform: translateY(0); +} + +.increment-button:focus-visible { + outline: 3px solid var(--accent-gradient-end); + outline-offset: 2px; +} + +.increment-icon { + transition: transform 0.3s ease; +} + +.increment-button:hover .increment-icon { + transform: scale(1.1); +} + +/* Toggle switch */ +.toggle-switch { + display: flex; + background: rgba(255, 255, 255, 0.1); + border-radius: 0.5rem; + padding: 0.25rem; + gap: 0.25rem; + border: 1px solid var(--weather-card-border); + margin: 0; + padding: 0.25rem; + min-width: 0; +} + +.toggle-switch legend { + padding: 0; +} + +@media (prefers-color-scheme: light) { + .toggle-switch { + background: rgba(102, 126, 234, 0.08); + } +} + +.toggle-option { + display: flex; + align-items: center; + justify-content: center; + background: transparent; + color: var(--text-secondary); + border: none; + border-radius: 0.375rem; + padding: 0 1rem; + height: 2.5rem; + font-size: 0.875rem; + font-weight: 600; + cursor: pointer; + transition: all 0.3s ease; + min-width: 3rem; + position: relative; +} + +.toggle-option[aria-pressed="true"] { + background: linear-gradient(135deg, var(--accent-gradient-start) 0%, var(--accent-gradient-end) 100%); + color: white; + box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3); +} + +.toggle-option[aria-pressed="false"]:hover { + background: rgba(255, 255, 255, 0.05); + color: var(--text-primary); +} + +@media (prefers-color-scheme: light) { + .toggle-option[aria-pressed="false"]:hover { + background: rgba(102, 126, 234, 0.1); + } +} + +.toggle-option:focus-visible { + outline: 3px solid var(--focus-color); + outline-offset: 2px; + z-index: 1; +} + +/* Refresh button */ +.refresh-button { + display: flex; + align-items: center; + justify-content: center; + gap: 0.5rem; + background: linear-gradient(135deg, var(--accent-gradient-start) 0%, var(--accent-gradient-end) 100%); + color: white; + border: none; + border-radius: 0.5rem; + padding: 0 1.5rem; + height: var(--cta-height); + font-size: 0.875rem; + font-weight: 600; + cursor: pointer; + transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease; + box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3); + min-width: 140px; + white-space: nowrap; +} + +.refresh-button:hover:not(:disabled) { + transform: translateY(-1px); + box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4); +} + +.refresh-button:disabled { + opacity: 0.6; + cursor: not-allowed; + transform: none; +} + +.refresh-button:focus-visible { + outline: 3px solid var(--focus-color); + outline-offset: 3px; +} + +.refresh-icon { + transition: transform 0.3s ease; +} + +.refresh-icon.spinning { + animation: spin 1s linear infinite; +} + +/* Error message */ +.error-message { + display: flex; + align-items: center; + gap: 0.75rem; + background-color: var(--error-bg); + border-left: 4px solid var(--error-border); + color: var(--error-text); + padding: 1rem; + border-radius: 0.5rem; + margin: 1rem 0; + animation: slideIn 0.3s ease-out; +} + +/* Loading skeleton */ +.loading-skeleton { + display: flex; + flex-direction: column; + gap: 1rem; + margin-top: 1rem; +} + +.skeleton-row { + height: 80px; + background: linear-gradient(90deg, var(--skeleton-bg-1) 25%, var(--skeleton-bg-2) 50%, var(--skeleton-bg-1) 75%); + background-size: 200% 100%; + animation: shimmer 1.5s infinite; + border-radius: 0.5rem; +} + +/* Weather grid */ +.weather-grid { + display: grid; + grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); + gap: 1rem; + margin-top: 0.75rem; +} + +.weather-card { + background: var(--weather-card-bg); + border-radius: 0.75rem; + padding: 1.25rem; + display: flex; + flex-direction: column; + gap: 0.75rem; + transition: all 0.3s ease; + border: 1px solid var(--weather-card-border); + backdrop-filter: blur(10px); + min-height: var(--tile-min-height); +} + +.weather-card:hover { + transform: translateY(-4px); + box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2); +} + +.weather-card:focus-within { + outline: 2px solid var(--focus-color); + outline-offset: 2px; +} + +.weather-date { + font-weight: 600; + font-size: 0.875rem; + color: var(--date-color); + text-transform: uppercase; + letter-spacing: 0.05em; + margin: 0; +} + +.weather-summary { + font-size: 1.125rem; + font-weight: 500; + color: var(--summary-color); + min-height: 1.5rem; + margin: 0; +} + +.weather-temps { + display: flex; + align-items: center; + justify-content: center; + gap: 0.75rem; + margin-top: 0.5rem; + padding-top: 0.75rem; + border-top: 1px solid var(--weather-card-border); +} + +.temp-group { + display: flex; + flex-direction: column; + align-items: center; + width: 100%; +} + +.temp-value { + font-size: 1.5rem; + font-weight: 700; + background: linear-gradient(135deg, var(--accent-gradient-start) 0%, var(--accent-gradient-end) 100%); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + background-clip: text; +} + +.temp-unit { + font-size: 0.75rem; + color: var(--temp-unit-color); + margin-top: 0.125rem; +} + +/* Responsive design */ +@media (max-width: 1024px) { + .main-content { + padding: 1rem; + } +} +.app-footer { + padding: 1.5rem; + text-align: center; + background: rgba(0, 0, 0, 0.2); + backdrop-filter: blur(10px); +} + +.app-footer nav { + display: flex; + justify-content: center; + align-items: center; + gap: 1.5rem; +} + +.app-footer a { + color: var(--text-secondary); + text-decoration: none; + font-weight: 500; + transition: color 0.3s ease, border-color 0.3s ease; + border-bottom: 2px solid transparent; + font-size: 0.875rem; + padding-bottom: 0.125rem; +} + +.app-footer a:hover { + color: var(--text-primary); + border-bottom-color: var(--text-primary); +} + +.app-footer a:focus-visible { + outline: 3px solid var(--focus-color); + outline-offset: 4px; + border-radius: 4px; +} + +/* Animations */ +@keyframes fadeInDown { + from { + opacity: 0; + transform: translateY(-20px); + } + to { + opacity: 1; + transform: translateY(0); + } +} + +@keyframes fadeInUp { + from { + opacity: 0; + transform: translateY(20px); + } + to { + opacity: 1; + transform: translateY(0); + } +} + +@keyframes slideIn { + from { + opacity: 0; + transform: translateX(-10px); + } + to { + opacity: 1; + transform: translateX(0); + } +} + +@keyframes spin { + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } +} + +@keyframes shimmer { + 0% { + background-position: -200% 0; + } + 100% { + background-position: 200% 0; + } +} + +/* Responsive design */ +@media (max-width: 1024px) { + .main-content { + grid-template-columns: 1fr; + padding: 1rem; + gap: 1rem; + } +} + +/* Footer */ +.app-footer { + padding: 1.5rem 0; + text-align: center; + background: rgba(0, 0, 0, 0.2); + backdrop-filter: blur(10px); + display: flex; + justify-content: center; + align-items: center; +} + +.app-footer > * { + max-width: 1400px; + width: 100%; + display: flex; + justify-content: space-between; + align-items: center; + padding: 0 2rem; + gap: 1rem; +} + +.app-footer a { + color: var(--text-secondary); + text-decoration: none; + font-weight: 500; + transition: color 0.3s ease, transform 0.3s ease; + border-bottom: 2px solid transparent; + font-size: 0.875rem; +} + +.app-footer a:hover { + color: var(--text-primary); + border-bottom-color: var(--text-primary); +} + +.app-footer a:focus-visible { + outline: 2px solid var(--text-primary); + outline-offset: 4px; + border-radius: 2px; +} + +.github-link { + display: inline-flex; + align-items: center; + gap: 0.5rem; + border-bottom: none !important; +} + +.github-link:focus-visible { + outline: 3px solid var(--focus-color); + outline-offset: 4px; + border-radius: 4px; +} + +.github-link img { + transition: transform 0.3s ease, opacity 0.3s ease; + filter: brightness(0) invert(1); +} + +@media (prefers-color-scheme: light) { + .github-link img { + filter: brightness(0) invert(0); + opacity: 0.7; + } + + .github-link:hover img { + opacity: 1; + } +} + +.github-link:hover img { + transform: scale(1.1); +} + +@media (max-width: 768px) { + :root { + --cta-height: 2.75rem; + } + + .app-header { + padding: 1.5rem 1rem 1rem; + } + + .logo { + height: 3rem; + } + + .app-title { + font-size: 1.5rem; + } + + .app-subtitle { + font-size: 0.875rem; + } + + .main-content { + padding: 0.75rem; + } + + .card { + padding: 1rem; + } + + .section-title { + font-size: 1.125rem; + } + + .section-header { + flex-direction: column; + align-items: stretch; + gap: 0.75rem; + } + + .header-actions { + width: 100%; + } + + .toggle-switch { + flex: 1; + } + + .toggle-option { + flex: 1; + } + + .refresh-button { + flex: 1; + justify-content: center; + padding: 0 1.25rem; + } + + .weather-grid { + grid-template-columns: 1fr; + gap: 0.75rem; + } + + .weather-card { + padding: 1.25rem; + } + + .app-footer { + padding: 1rem 0; + } + + .app-footer > * { + flex-direction: column; + padding: 0 1.5rem; + } + + .github-link { + order: -1; + } +} + +/* Reduced motion support */ +@media (prefers-reduced-motion: reduce) { + *, + *::before, + *::after { + animation-duration: 0.01ms !important; + animation-iteration-count: 1 !important; + transition-duration: 0.01ms !important; + } +} + +/* High contrast mode support */ +@media (prefers-contrast: high) { + .card { + border: 2px solid currentColor; + } + + .weather-card { + border: 1px solid currentColor; + } +} + +/* Focus visible support for better keyboard navigation */ +*:focus-visible { + outline: 3px solid var(--accent-gradient-end); + outline-offset: 2px; +} + diff --git a/playground/JavaAppHost/frontend/src/App.tsx b/playground/JavaAppHost/frontend/src/App.tsx new file mode 100644 index 00000000000..b9b5a1b10ae --- /dev/null +++ b/playground/JavaAppHost/frontend/src/App.tsx @@ -0,0 +1,184 @@ +import { useState, useEffect } from 'react'; +import aspireLogo from '/Aspire.png'; +import './App.css'; + +interface WeatherForecast { + date: string; + temperatureC: number; + temperatureF: number; + summary: string; +} + +function App() { + const [weatherData, setWeatherData] = useState([]); + const [loading, setLoading] = useState(false); + const [error, setError] = useState(null); + const [useCelsius, setUseCelsius] = useState(false); + + const fetchWeatherForecast = async () => { + setLoading(true); + setError(null); + + try { + const response = await fetch('/api/weatherforecast'); + + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + + const data: WeatherForecast[] = await response.json(); + setWeatherData(data); + } catch (err) { + setError(err instanceof Error ? err.message : 'Failed to fetch weather data'); + console.error('Error fetching weather forecast:', err); + } finally { + setLoading(false); + } + }; + + useEffect(() => { + fetchWeatherForecast(); + }, []); + + const formatDate = (dateString: string) => { + return new Date(dateString).toLocaleDateString(undefined, { + weekday: 'short', + month: 'short', + day: 'numeric' + }); + }; + + return ( +
+
+ + Aspire logo + +

Aspire Starter

+

Modern distributed application development

+
+ +
+
+
+
+

Weather Forecast

+
+
+ Temperature unit + + +
+ +
+
+ + {error && ( +
+ + {error} +
+ )} + + {loading && weatherData.length === 0 && ( +
+ {[...Array(5)].map((_, i) => ( + + )} + + {weatherData.length > 0 && ( +
+ {weatherData.map((forecast, index) => ( +
+

+ +

+

{forecast.summary}

+
+
+ + +
+
+
+ ))} +
+ )} +
+
+
+ + +
+ ); +} + +export default App; diff --git a/playground/JavaAppHost/frontend/src/index.css b/playground/JavaAppHost/frontend/src/index.css new file mode 100644 index 00000000000..6d1b6557354 --- /dev/null +++ b/playground/JavaAppHost/frontend/src/index.css @@ -0,0 +1,55 @@ +:root { + font-family: system-ui, Avenir, Helvetica, Arial, sans-serif; + line-height: 1.5; + font-weight: 400; + + color-scheme: light dark; + + font-synthesis: none; + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +/* Reset and base styles */ +*, +*::before, +*::after { + box-sizing: border-box; +} + +html { + margin: 0; + padding: 0; + width: 100%; + height: 100%; + overflow-x: hidden; +} + +body { + margin: 0; + padding: 0; + width: 100%; + min-height: 100vh; + overflow-x: hidden; +} + +/* Remove default Vite styles that conflict with our design */ +h1 { + margin: 0; +} + +button { + font-family: inherit; + cursor: pointer; +} + +@media (prefers-reduced-motion: reduce) { + *, + *::before, + *::after { + animation-duration: 0.01ms !important; + animation-iteration-count: 1 !important; + transition-duration: 0.01ms !important; + } +} diff --git a/playground/JavaAppHost/frontend/src/main.tsx b/playground/JavaAppHost/frontend/src/main.tsx new file mode 100644 index 00000000000..2239905c14d --- /dev/null +++ b/playground/JavaAppHost/frontend/src/main.tsx @@ -0,0 +1,10 @@ +import { StrictMode } from 'react'; +import { createRoot } from 'react-dom/client'; +import './index.css'; +import App from './App.tsx'; + +createRoot(document.getElementById('root')!).render( + + + , +); diff --git a/playground/JavaAppHost/frontend/src/vite-env.d.ts b/playground/JavaAppHost/frontend/src/vite-env.d.ts new file mode 100644 index 00000000000..11f02fe2a00 --- /dev/null +++ b/playground/JavaAppHost/frontend/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/playground/JavaAppHost/frontend/tsconfig.app.json b/playground/JavaAppHost/frontend/tsconfig.app.json new file mode 100644 index 00000000000..c9ccbd4c594 --- /dev/null +++ b/playground/JavaAppHost/frontend/tsconfig.app.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", + "target": "ES2020", + "useDefineForClassFields": true, + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "module": "ESNext", + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "moduleDetection": "force", + "noEmit": true, + "jsx": "react-jsx", + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "erasableSyntaxOnly": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedSideEffectImports": true + }, + "include": ["src"] +} diff --git a/playground/JavaAppHost/frontend/tsconfig.json b/playground/JavaAppHost/frontend/tsconfig.json new file mode 100644 index 00000000000..1ffef600d95 --- /dev/null +++ b/playground/JavaAppHost/frontend/tsconfig.json @@ -0,0 +1,7 @@ +{ + "files": [], + "references": [ + { "path": "./tsconfig.app.json" }, + { "path": "./tsconfig.node.json" } + ] +} diff --git a/playground/JavaAppHost/frontend/tsconfig.node.json b/playground/JavaAppHost/frontend/tsconfig.node.json new file mode 100644 index 00000000000..9728af2d81a --- /dev/null +++ b/playground/JavaAppHost/frontend/tsconfig.node.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", + "target": "ES2022", + "lib": ["ES2023"], + "module": "ESNext", + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "moduleDetection": "force", + "noEmit": true, + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "erasableSyntaxOnly": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedSideEffectImports": true + }, + "include": ["vite.config.ts"] +} diff --git a/playground/JavaAppHost/frontend/vite.config.ts b/playground/JavaAppHost/frontend/vite.config.ts new file mode 100644 index 00000000000..22861934212 --- /dev/null +++ b/playground/JavaAppHost/frontend/vite.config.ts @@ -0,0 +1,18 @@ +import { defineConfig } from 'vite'; +import react from '@vitejs/plugin-react'; + +const proxyTarget = process.env.APP_HTTPS || process.env.APP_HTTP || 'http://localhost:5000'; + +// https://vite.dev/config/ +export default defineConfig({ + plugins: [react()], + server: { + proxy: { + // Proxy API calls to the Express service + '/api': { + target: proxyTarget, + changeOrigin: true + } + } + } +}); diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.AppConfiguration/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Azure.AppConfiguration/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..41b398aa684 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.AppConfiguration/ValidationAppHost/AppHost.java @@ -0,0 +1,13 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + var appConfig = builder.addAzureAppConfiguration("appconfig"); + appConfig.withAppConfigurationRoleAssignments(appConfig, new AzureAppConfigurationRole[] { AzureAppConfigurationRole.APP_CONFIGURATION_DATA_OWNER, AzureAppConfigurationRole.APP_CONFIGURATION_DATA_READER }); + appConfig.runAsEmulator((emulator) -> { + emulator.withDataBindMount(".aace/appconfig"); + emulator.withDataVolume("appconfig-data"); + emulator.withHostPort(8483.0); + }); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.AppConfiguration/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Azure.AppConfiguration/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..27292ed17b7 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.AppConfiguration/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Azure.AppConfiguration": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:29550;http://localhost:28731", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10775", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:13119" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.AppContainers/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Azure.AppContainers/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..4b88466ea59 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.AppContainers/ValidationAppHost/AppHost.java @@ -0,0 +1,53 @@ +import aspire.*; + +void main() throws Exception { + // Aspire TypeScript AppHost - Validation for Aspire.Hosting.Azure.AppContainers + // For more information, see: https://aspire.dev + var builder = DistributedApplication.CreateBuilder(); + // === Azure Container App Environment === + // Test addAzureContainerAppEnvironment factory method + var env = builder.addAzureContainerAppEnvironment("myenv"); + // Test fluent chaining on AzureContainerAppEnvironmentResource + env + .withAzdResourceNaming() + .withCompactResourceNaming() + .withDashboard(true) + .withHttpsUpgrade(false); + // Test withDashboard with no args (uses default) + var env2 = builder.addAzureContainerAppEnvironment("myenv2"); + env2.withDashboard(); + // Test withHttpsUpgrade with no args (uses default) + env2.withHttpsUpgrade(); + // === WithAzureLogAnalyticsWorkspace === + // Test withAzureLogAnalyticsWorkspace with a Log Analytics Workspace resource + var laws = builder.addAzureLogAnalyticsWorkspace("laws"); + var env3 = builder.addAzureContainerAppEnvironment("myenv3"); + env3.withAzureLogAnalyticsWorkspace(laws); + // === PublishAsAzureContainerApp === + // Test publishAsAzureContainerApp on a container resource with callback + var web = builder.addContainer("web", "myregistry/web:latest"); + web.publishAsAzureContainerApp((infrastructure, app) -> { + // Configure container app via callback + }); + // Test publishAsAzureContainerAppJob on an executable resource + var api = builder.addExecutable("api", "dotnet", ".", new String[] { "run" }); + api.publishAsAzureContainerAppJob(); + // === PublishAsAzureContainerAppJob === + // Test publishAsAzureContainerAppJob (parameterless - manual trigger) + var worker = builder.addContainer("worker", "myregistry/worker:latest"); + worker.publishAsAzureContainerAppJob(); + // Test publishAsConfiguredAzureContainerAppJob (with callback) + var processor = builder.addContainer("processor", "myregistry/processor:latest"); + processor.publishAsConfiguredAzureContainerAppJob((infrastructure, job) -> { + // Configure the container app job here + }); + // Test publishAsScheduledAzureContainerAppJob (simple - no callback) + var scheduler = builder.addContainer("scheduler", "myregistry/scheduler:latest"); + scheduler.publishAsScheduledAzureContainerAppJob("0 0 * * *"); + // Test publishAsConfiguredScheduledAzureContainerAppJob (with callback) + var reporter = builder.addContainer("reporter", "myregistry/reporter:latest"); + reporter.publishAsConfiguredScheduledAzureContainerAppJob("0 */6 * * *", (infrastructure, job) -> { + // Configure the scheduled job here + }); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.AppContainers/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Azure.AppContainers/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..0f8b741f5ec --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.AppContainers/ValidationAppHost/aspire.config.json @@ -0,0 +1,22 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Azure.AppContainers": "", + "Aspire.Hosting.Azure.OperationalInsights": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:49511;http://localhost:51415", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:48887", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:33229" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.AppService/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Azure.AppService/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..17eb325d89d --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.AppService/ValidationAppHost/AppHost.java @@ -0,0 +1,31 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + var applicationInsightsLocation = builder.addParameter("applicationInsightsLocation"); + var deploymentSlot = builder.addParameter("deploymentSlot"); + var existingApplicationInsights = builder.addAzureApplicationInsights("existingApplicationInsights"); + var environment = builder.addAzureAppServiceEnvironment("appservice-environment") + .withDashboard() + .withDashboard(false) + .withAzureApplicationInsights() + .withAzureApplicationInsightsLocation("westus") + .withAzureApplicationInsightsLocationParameter(applicationInsightsLocation) + .withAzureApplicationInsightsResource(existingApplicationInsights) + .withDeploymentSlotParameter(deploymentSlot) + .withDeploymentSlot("staging"); + var website = builder.addContainer("frontend", "nginx"); + website.skipEnvironmentVariableNameChecks(); + website.publishAsAzureAppServiceWebsite(new PublishAsAzureAppServiceWebsiteOptions().configure((_infrastructure, _appService) -> {}).configureSlot((_infrastructure, _appServiceSlot) -> {})); + + var worker = builder.addExecutable("worker", "dotnet", ".", new String[] { "run" }); + worker.skipEnvironmentVariableNameChecks(); + worker.publishAsAzureAppServiceWebsite(new PublishAsAzureAppServiceWebsiteOptions().configure((_infrastructure, _appService) -> {})); + + var api = builder.addProject("api", "../Fake.Api/Fake.Api.csproj", "https"); + api.skipEnvironmentVariableNameChecks(); + api.publishAsAzureAppServiceWebsite(new PublishAsAzureAppServiceWebsiteOptions().configureSlot((_infrastructure, _appServiceSlot) -> {})); + var _environmentName = environment.getResourceName(); + var _websiteName = website.getResourceName(); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.AppService/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Azure.AppService/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..dfa441ef5c3 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.AppService/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Azure.AppService": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:49511;http://localhost:51415", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:48887", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:33229" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.ApplicationInsights/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Azure.ApplicationInsights/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..de7f6235893 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.ApplicationInsights/ValidationAppHost/AppHost.java @@ -0,0 +1,16 @@ +import aspire.*; + +void main() throws Exception { + // Aspire TypeScript AppHost - Azure Application Insights validation + // Exercises exported members of Aspire.Hosting.Azure.ApplicationInsights + var builder = DistributedApplication.CreateBuilder(); + // addAzureApplicationInsights - factory method with just a name + var appInsights = builder.addAzureApplicationInsights("insights"); + // addAzureLogAnalyticsWorkspace - from the OperationalInsights dependency + var logAnalytics = builder.addAzureLogAnalyticsWorkspace("logs"); + // withLogAnalyticsWorkspace - fluent method to associate a workspace + var appInsightsWithWorkspace = builder + .addAzureApplicationInsights("insights-with-workspace") + .withLogAnalyticsWorkspace(logAnalytics); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.ApplicationInsights/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Azure.ApplicationInsights/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..518e59f7b5a --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.ApplicationInsights/ValidationAppHost/aspire.config.json @@ -0,0 +1,22 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Azure.ApplicationInsights": "", + "Aspire.Hosting.Azure.OperationalInsights": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:43145;http://localhost:38016", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:43154", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:41056" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.CognitiveServices/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Azure.CognitiveServices/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..c1c3c1c53f2 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.CognitiveServices/ValidationAppHost/AppHost.java @@ -0,0 +1,12 @@ +import aspire.*; + +void main() throws Exception { + // Aspire TypeScript AppHost + // For more information, see: https://aspire.dev + var builder = DistributedApplication.CreateBuilder(); + var openai = builder.addAzureOpenAI("openai"); + openai.addDeployment("chat", "gpt-4o-mini", "2024-07-18"); + var api = builder.addContainer("api", "redis:latest"); + api.withCognitiveServicesRoleAssignments(openai, new AzureOpenAIRole[] { AzureOpenAIRole.COGNITIVE_SERVICES_OPEN_AIUSER }); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.CognitiveServices/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Azure.CognitiveServices/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..3a110f0e48a --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.CognitiveServices/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Azure.CognitiveServices": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:55134;http://localhost:18351", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:34251", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:60108" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.ContainerRegistry/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Azure.ContainerRegistry/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..d8cb58aba89 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.ContainerRegistry/ValidationAppHost/AppHost.java @@ -0,0 +1,13 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + var registry = builder.addAzureContainerRegistry("containerregistry") + .withPurgeTask("0 1 * * *", new WithPurgeTaskOptions().filter("samples:*").ago(7.0).keep(5.0).taskName("purge-samples")); + var environment = builder.addAzureContainerAppEnvironment("environment"); + environment.withAzureContainerRegistry(registry); + environment.withContainerRegistryRoleAssignments(registry, new AzureContainerRegistryRole[] { AzureContainerRegistryRole.ACR_PULL, AzureContainerRegistryRole.ACR_PUSH }); + var registryFromEnvironment = environment.getAzureContainerRegistry(); + registryFromEnvironment.withPurgeTask("0 2 * * *", new WithPurgeTaskOptions().filter("environment:*").ago(14.0).keep(2.0)); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.ContainerRegistry/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Azure.ContainerRegistry/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..05b2a6ff23f --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.ContainerRegistry/ValidationAppHost/aspire.config.json @@ -0,0 +1,22 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Azure.ContainerRegistry": "", + "Aspire.Hosting.Azure.AppContainers": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:29550;http://localhost:28731", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10775", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:13119" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.CosmosDB/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Azure.CosmosDB/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..c9a470bb048 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.CosmosDB/ValidationAppHost/AppHost.java @@ -0,0 +1,34 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + // 1) addAzureCosmosDB + var cosmos = builder.addAzureCosmosDB("cosmos"); + // 2) withDefaultAzureSku + cosmos.withDefaultAzureSku(); + // 3) addCosmosDatabase + var db = cosmos.addCosmosDatabase("app-db", "appdb"); + // 4) addContainer (single partition key path) + db.addContainer("orders", "/orderId", "orders-container"); + // 5) addContainerWithPartitionKeyPaths (IEnumerable export) + db.addContainerWithPartitionKeyPaths("events", new String[] { "/tenantId", "/eventId" }, "events-container"); + // 6) withAccessKeyAuthentication + cosmos.withAccessKeyAuthentication(); + // 7) withAccessKeyAuthenticationWithKeyVault + var keyVault = builder.addAzureKeyVault("kv"); + cosmos.withAccessKeyAuthenticationWithKeyVault(keyVault); + // 8) runAsEmulator + emulator container configuration methods + var cosmosEmulator = builder.addAzureCosmosDB("cosmos-emulator"); + cosmosEmulator.runAsEmulator((emulator) -> { + emulator.withDataVolume("cosmos-emulator-data"); // 9) withDataVolume + emulator.withGatewayPort(18081.0); // 10) withGatewayPort + emulator.withPartitionCount(25); // 11) withPartitionCount + }); + // 12) runAsPreviewEmulator + 13) withDataExplorer + var cosmosPreview = builder.addAzureCosmosDB("cosmos-preview-emulator"); + cosmosPreview.runAsPreviewEmulator((emulator) -> { + emulator.withDataExplorer(11234.0); + }); + var app = builder.build(); + app.run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.CosmosDB/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Azure.CosmosDB/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..34ccc12e203 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.CosmosDB/ValidationAppHost/aspire.config.json @@ -0,0 +1,22 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Azure.CosmosDB": "", + "Aspire.Hosting.Azure.KeyVault": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:52066;http://localhost:47700", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:62976", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:34207" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.EventHubs/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Azure.EventHubs/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..5fb963795a8 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.EventHubs/ValidationAppHost/AppHost.java @@ -0,0 +1,23 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + var eventHubs = builder.addAzureEventHubs("eventhubs"); + eventHubs.withEventHubsRoleAssignments(eventHubs, new AzureEventHubsRole[] { AzureEventHubsRole.AZURE_EVENT_HUBS_DATA_OWNER }); + var hub = eventHubs.addHub("orders", "orders-hub"); + hub.withProperties((configuredHub) -> { + configuredHub.setHubName("orders-hub"); + var _hubName = configuredHub.hubName(); + configuredHub.setPartitionCount(2); + var _partitionCount = configuredHub.partitionCount(); + }); + var consumerGroup = hub.addConsumerGroup("processors", "processor-group"); + consumerGroup.withEventHubsRoleAssignments(eventHubs, new AzureEventHubsRole[] { AzureEventHubsRole.AZURE_EVENT_HUBS_DATA_RECEIVER }); + eventHubs.runAsEmulator((emulator) -> { + emulator + .withHostPort(5673.0) + .withConfigurationFile("./eventhubs.config.json") + .withEventHubsRoleAssignments(eventHubs, new AzureEventHubsRole[] { AzureEventHubsRole.AZURE_EVENT_HUBS_DATA_SENDER }); + }); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.EventHubs/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Azure.EventHubs/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..93c44b95c38 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.EventHubs/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Azure.EventHubs": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:29550;http://localhost:28731", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10775", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:13119" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.Functions/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Azure.Functions/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..9560020455e --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.Functions/ValidationAppHost/AppHost.java @@ -0,0 +1,25 @@ +import aspire.*; + +void main() throws Exception { + // Aspire TypeScript AppHost - Azure Functions validation + // Exercises every exported member of Aspire.Hosting.Azure.Functions + var builder = DistributedApplication.CreateBuilder(); + // ── 1. addAzureFunctionsProject (path-based overload) ─────────────────────── + var funcApp = builder.addAzureFunctionsProject( + "myfunc", + "../MyFunctions/MyFunctions.csproj" + ); + // ── 2. withHostStorage - specify custom Azure Storage for Functions host ──── + var storage = builder.addAzureStorage("funcstorage"); + funcApp.withHostStorage(storage); + // ── 3. Fluent chaining - verify return types enable chaining ──────────────── + var chainedFunc = builder + .addAzureFunctionsProject("chained-func", "../OtherFunc/OtherFunc.csproj") + .withHostStorage(storage); + chainedFunc.withEnvironment("MY_KEY", "my-value"); + chainedFunc.withHttpEndpoint(new WithHttpEndpointOptions().port(7071.0)); + // ── 4. withReference from base builder - standard resource references ─────── + var anotherStorage = builder.addAzureStorage("appstorage"); + funcApp.withReference(anotherStorage); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.Functions/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Azure.Functions/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..5a76f18d0dc --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.Functions/ValidationAppHost/aspire.config.json @@ -0,0 +1,22 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Azure.Functions": "", + "Aspire.Hosting.Azure.Storage": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:43912;http://localhost:19322", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:30254", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:15931" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.KeyVault/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Azure.KeyVault/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..d58fefaff26 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.KeyVault/ValidationAppHost/AppHost.java @@ -0,0 +1,33 @@ +import aspire.*; + +void main() throws Exception { + // Aspire TypeScript AppHost - Azure Key Vault validation + // Exercises every exported member of Aspire.Hosting.Azure.KeyVault + var builder = DistributedApplication.CreateBuilder(); + // ── 1. addAzureKeyVault ────────────────────────────────────────────────────── + var vault = builder.addAzureKeyVault("vault"); + // Parameters for secret-based APIs + var secretParam = builder.addParameter("secret-param", true); + var namedSecretParam = builder.addParameter("named-secret-param", true); + // Reference expressions for expression-based APIs + var exprSecretValue = ReferenceExpression.refExpr("secret-value-%s", secretParam); + var namedExprSecretValue = ReferenceExpression.refExpr("named-secret-value-%s", namedSecretParam); + // ── 2. withRoleAssignments ─────────────────────────────────────────────────── + vault.withKeyVaultRoleAssignments(vault, new AzureKeyVaultRole[] { AzureKeyVaultRole.KEY_VAULT_READER, AzureKeyVaultRole.KEY_VAULT_SECRETS_USER }); + // ── 3. addSecret ───────────────────────────────────────────────────────────── + var secretFromParameter = vault.addSecret("param-secret", secretParam); + // ── 4. addSecretFromExpression ─────────────────────────────────────────────── + var secretFromExpression = vault.addSecretFromExpression("expr-secret", exprSecretValue); + // ── 5. addSecretWithName ───────────────────────────────────────────────────── + var namedSecretFromParameter = vault.addSecretWithName("secret-resource-param", "named-param-secret", namedSecretParam); + // ── 6. addSecretWithNameFromExpression ─────────────────────────────────────── + var namedSecretFromExpression = vault.addSecretWithNameFromExpression("secret-resource-expr", "named-expr-secret", namedExprSecretValue); + // ── 7. getSecret ───────────────────────────────────────────────────────────── + var _existingSecretRef = vault.getSecret("param-secret"); + // Apply role assignments to created secret resources to validate generic coverage. + secretFromParameter.withKeyVaultRoleAssignments(vault, new AzureKeyVaultRole[] { AzureKeyVaultRole.KEY_VAULT_SECRETS_USER }); + secretFromExpression.withKeyVaultRoleAssignments(vault, new AzureKeyVaultRole[] { AzureKeyVaultRole.KEY_VAULT_READER }); + namedSecretFromParameter.withKeyVaultRoleAssignments(vault, new AzureKeyVaultRole[] { AzureKeyVaultRole.KEY_VAULT_SECRETS_OFFICER }); + namedSecretFromExpression.withKeyVaultRoleAssignments(vault, new AzureKeyVaultRole[] { AzureKeyVaultRole.KEY_VAULT_READER }); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.KeyVault/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Azure.KeyVault/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..c9677bb0c22 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.KeyVault/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Azure.KeyVault": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:52800;http://localhost:51322", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10120", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:11479" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.Kusto/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Azure.Kusto/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..dde9ff22c0a --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.Kusto/ValidationAppHost/AppHost.java @@ -0,0 +1,24 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + var kusto = builder.addAzureKustoCluster("kusto").runAsEmulator((emulator) -> { + emulator.withHostPort(8088.0); + }); + var defaultDatabase = kusto.addReadWriteDatabase("samples"); + var customDatabase = kusto.addReadWriteDatabase("analytics", "AnalyticsDb"); + defaultDatabase.withCreationScript(".create database Samples ifnotexists"); + customDatabase.withCreationScript(".create database AnalyticsDb ifnotexists"); + var _isEmulator = kusto.isEmulator(); + var _clusterUri = kusto.uriExpression(); + var _clusterConnectionString = kusto.connectionStringExpression(); + var _defaultDatabaseName = defaultDatabase.databaseName(); + var _defaultDatabaseParent = defaultDatabase.parent(); + var _defaultDatabaseConnectionString = defaultDatabase.connectionStringExpression(); + var _defaultDatabaseCreationScript = defaultDatabase.getDatabaseCreationScript(); + var _customDatabaseName = customDatabase.databaseName(); + var _customDatabaseParent = customDatabase.parent(); + var _customDatabaseConnectionString = customDatabase.connectionStringExpression(); + var _customDatabaseCreationScript = customDatabase.getDatabaseCreationScript(); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.Kusto/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Azure.Kusto/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..2852208ec5a --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.Kusto/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Azure.Kusto": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:29550;http://localhost:28731", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10775", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:13119" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.OperationalInsights/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Azure.OperationalInsights/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..7a9dea707de --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.OperationalInsights/ValidationAppHost/AppHost.java @@ -0,0 +1,12 @@ +import aspire.*; + +void main() throws Exception { + // Aspire TypeScript AppHost - Azure Operational Insights validation + // Exercises exported members of Aspire.Hosting.Azure.OperationalInsights + var builder = DistributedApplication.CreateBuilder(); + // addAzureLogAnalyticsWorkspace + var logAnalytics = builder.addAzureLogAnalyticsWorkspace("logs"); + // Fluent call on the returned resource builder + logAnalytics.withUrl("https://example.local/logs"); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.OperationalInsights/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Azure.OperationalInsights/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..bf0451493b8 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.OperationalInsights/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Azure.OperationalInsights": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:52066;http://localhost:47700", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:62976", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:34207" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.PostgreSQL/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Azure.PostgreSQL/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..ab3c5358286 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.PostgreSQL/ValidationAppHost/AppHost.java @@ -0,0 +1,22 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + // 1) addAzurePostgresFlexibleServer - main factory method + var pg = builder.addAzurePostgresFlexibleServer("pg"); + // 2) addDatabase - child resource + var db = pg.addDatabase("mydb", "appdb"); + // 3) withPasswordAuthentication - configures password auth (auto KeyVault) + var pgAuth = builder.addAzurePostgresFlexibleServer("pg-auth"); + pgAuth.withPasswordAuthentication(); + // 4) runAsContainer - run as local PostgreSQL container + var pgContainer = builder.addAzurePostgresFlexibleServer("pg-container"); + pgContainer.runAsContainer((container) -> { + // Exercise PostgresServerResource builder methods within the callback + container.withLifetime(ContainerLifetime.PERSISTENT); + }); + // 5) addDatabase on container-mode server + var dbContainer = pgContainer.addDatabase("containerdb"); + var app = builder.build(); + app.run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.PostgreSQL/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Azure.PostgreSQL/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..a62de16f4b0 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.PostgreSQL/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Azure.PostgreSQL": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:52067;http://localhost:47701", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:62977", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:34208" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.Redis/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Azure.Redis/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..7bcb460e1a7 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.Redis/ValidationAppHost/AppHost.java @@ -0,0 +1,30 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + var keyVault = builder.addAzureKeyVault("vault"); + var cache = builder.addAzureManagedRedis("cache"); + var accessKeyCache = builder.addAzureManagedRedis("cache-access-key"); + var containerCache = builder.addAzureManagedRedis("cache-container"); + accessKeyCache.withAccessKeyAuthentication(); + accessKeyCache.withAccessKeyAuthenticationWithKeyVault(keyVault); + containerCache.runAsContainer((container) -> { + container.withVolume("/data"); + }); + var _connectionString = cache.connectionStringExpression(); + var _hostName = cache.hostName(); + var _port = cache.port(); + var _uri = cache.uriExpression(); + var _useAccessKeyAuthentication = cache.useAccessKeyAuthentication(); + var _accessKeyConnectionString = accessKeyCache.connectionStringExpression(); + var _accessKeyHostName = accessKeyCache.hostName(); + var _accessKeyPassword = accessKeyCache.password(); + var _accessKeyUri = accessKeyCache.uriExpression(); + var _usesAccessKeyAuthentication = accessKeyCache.useAccessKeyAuthentication(); + var _containerConnectionString = containerCache.connectionStringExpression(); + var _containerHostName = containerCache.hostName(); + var _containerPort = containerCache.port(); + var _containerPassword = containerCache.password(); + var _containerUri = containerCache.uriExpression(); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.Redis/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Azure.Redis/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..3023a9cac69 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.Redis/ValidationAppHost/aspire.config.json @@ -0,0 +1,22 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Azure.Redis": "", + "Aspire.Hosting.Azure.KeyVault": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:29550;http://localhost:28731", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10775", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:13119" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.Search/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Azure.Search/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..1991ccc23cd --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.Search/ValidationAppHost/AppHost.java @@ -0,0 +1,8 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + var search = builder.addAzureSearch("search"); + search.withSearchRoleAssignments(search, new AzureSearchRole[] { AzureSearchRole.SEARCH_SERVICE_CONTRIBUTOR, AzureSearchRole.SEARCH_INDEX_DATA_READER }); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.Search/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Azure.Search/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..b470b9e3c6a --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.Search/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Azure.Search": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:29550;http://localhost:28731", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10775", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:13119" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.ServiceBus/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Azure.ServiceBus/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..ec4fbbe7ab6 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.ServiceBus/ValidationAppHost/AppHost.java @@ -0,0 +1,42 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + var serviceBus = builder.addAzureServiceBus("messaging"); + var emulatorBus = builder + .addAzureServiceBus("messaging-emulator") + .runAsEmulator((emulator) -> { emulator.withConfigurationFile("./servicebus-config.json"); emulator.withHostPort(5672.0); }); + var queue = serviceBus.addServiceBusQueue("orders", "orders-queue"); + var topic = serviceBus.addServiceBusTopic("events", "events-topic"); + var subscription = topic.addServiceBusSubscription("audit", "audit-sub"); + var filter = new AzureServiceBusCorrelationFilter(); + filter.setCorrelationId("order-123"); + filter.setSubject("OrderCreated"); + filter.setContentType("application/json"); + filter.setMessageId("msg-001"); + filter.setReplyTo("reply-queue"); + filter.setSessionId("session-1"); + filter.setSendTo("destination"); + + var rule = new AzureServiceBusRule(); + rule.setName("order-filter"); + rule.setFilterType(AzureServiceBusFilterType.CORRELATION_FILTER); + rule.setCorrelationFilter(filter); + queue.withProperties((q) -> { q.setDeadLetteringOnMessageExpiration(true); q.setDefaultMessageTimeToLive(36000000000.0); q.setDuplicateDetectionHistoryTimeWindow(6000000000.0); q.setForwardDeadLetteredMessagesTo("dead-letter-queue"); q.setForwardTo("forwarding-queue"); q.setLockDuration(300000000.0); q.setMaxDeliveryCount(10); q.setRequiresDuplicateDetection(true); q.setRequiresSession(false); var _dlq = q.deadLetteringOnMessageExpiration(); var _ttl = q.defaultMessageTimeToLive(); var _fwd = q.forwardTo(); var _maxDel = q.maxDeliveryCount(); }); + topic.withProperties((t) -> { t.setDefaultMessageTimeToLive(6048000000000.0); t.setDuplicateDetectionHistoryTimeWindow(3000000000.0); t.setRequiresDuplicateDetection(false); var _dupDetect = t.requiresDuplicateDetection(); }); + subscription.withProperties((s) -> { s.setDeadLetteringOnMessageExpiration(true); s.setDefaultMessageTimeToLive(72000000000.0); s.setForwardDeadLetteredMessagesTo("sub-dlq"); s.setForwardTo("sub-forward"); s.setLockDuration(600000000.0); s.setMaxDeliveryCount(5); s.setRequiresSession(false); var _lock = s.lockDuration(); var _rules = s.rules(); }); + serviceBus.withServiceBusRoleAssignments(serviceBus, new AzureServiceBusRole[] { AzureServiceBusRole.AZURE_SERVICE_BUS_DATA_OWNER, AzureServiceBusRole.AZURE_SERVICE_BUS_DATA_SENDER, AzureServiceBusRole.AZURE_SERVICE_BUS_DATA_RECEIVER }); + queue.withServiceBusRoleAssignments(serviceBus, new AzureServiceBusRole[] { AzureServiceBusRole.AZURE_SERVICE_BUS_DATA_RECEIVER }); + topic.withServiceBusRoleAssignments(serviceBus, new AzureServiceBusRole[] { AzureServiceBusRole.AZURE_SERVICE_BUS_DATA_SENDER }); + subscription.withServiceBusRoleAssignments(serviceBus, new AzureServiceBusRole[] { AzureServiceBusRole.AZURE_SERVICE_BUS_DATA_RECEIVER }); + var _sqlFilter = AzureServiceBusFilterType.SQL_FILTER; + var _correlationFilter = AzureServiceBusFilterType.CORRELATION_FILTER; + serviceBus + .addServiceBusQueue("chained-queue") + .withProperties((_q) -> { }); + serviceBus + .addServiceBusTopic("chained-topic") + .addServiceBusSubscription("chained-sub") + .withProperties((_s) -> { }); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.ServiceBus/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Azure.ServiceBus/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..6cf597936a9 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.ServiceBus/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Azure.ServiceBus": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:24190;http://localhost:42530", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:60807", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:16724" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.SignalR/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Azure.SignalR/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..9f7d154cdae --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.SignalR/ValidationAppHost/AppHost.java @@ -0,0 +1,8 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + var signalr = builder.addAzureSignalR("signalr"); + signalr.runAsEmulator(); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.SignalR/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Azure.SignalR/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..30917d54c7f --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.SignalR/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Azure.SignalR": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:29550;http://localhost:28731", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10775", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:13119" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.Sql/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Azure.Sql/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..bf949c84dda --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.Sql/ValidationAppHost/AppHost.java @@ -0,0 +1,27 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + var storage = builder.addAzureStorage("storage"); + var sqlServer = builder.addAzureSqlServer("sql"); + var db = sqlServer.addDatabase("mydb"); + var db2 = sqlServer.addDatabase("inventory", "inventorydb"); + db2.withDefaultAzureSku(); + sqlServer.runAsContainer((container) -> { }); + sqlServer.withAdminDeploymentScriptStorage(storage); + var _db3 = sqlServer.addDatabase("analytics").withDefaultAzureSku(); + var _hostName = sqlServer.hostName(); + var _port = sqlServer.port(); + var _uriExpression = sqlServer.uriExpression(); + var _connectionStringExpression = sqlServer.connectionStringExpression(); + var _jdbcConnectionString = sqlServer.jdbcConnectionString(); + var _isContainer = sqlServer.isContainer(); + var _databases = sqlServer.databases(); + var _parent = db.parent(); + var _dbConnectionStringExpression = db.connectionStringExpression(); + var _databaseName = db.databaseName(); + var _dbIsContainer = db.isContainer(); + var _dbUriExpression = db.uriExpression(); + var _dbJdbcConnectionString = db.jdbcConnectionString(); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.Sql/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Azure.Sql/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..40f4e44f1b9 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.Sql/ValidationAppHost/aspire.config.json @@ -0,0 +1,22 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Azure.Sql": "", + "Aspire.Hosting.Azure.Storage": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:58695;http://localhost:30637", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:44501", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:55515" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.Storage/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Azure.Storage/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..2cd5b5f5706 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.Storage/ValidationAppHost/AppHost.java @@ -0,0 +1,24 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + var storage = builder.addAzureStorage("storage"); + storage.runAsEmulator(); + storage.withStorageRoleAssignments(storage, new AzureStorageRole[] { AzureStorageRole.STORAGE_BLOB_DATA_CONTRIBUTOR, AzureStorageRole.STORAGE_QUEUE_DATA_CONTRIBUTOR }); + // Callbacks are currently not working + // storage.runAsEmulator({ + // configureContainer: (emulator) -> { + // emulator.withBlobPort(10000); + // emulator.withQueuePort(10001); + // emulator.withTablePort(10002); + // emulator.withDataVolume(); + // emulator.withApiVersionCheck(new WithApiVersionCheckOptions().enable(false)); + // } + // }); + storage.addBlobs("blobs"); + storage.addTables("tables"); + storage.addQueues("queues"); + storage.addQueue("orders"); + storage.addBlobContainer("images"); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.Storage/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Azure.Storage/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..291d33b2e94 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.Storage/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Azure.Storage": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:52066;http://localhost:47700", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:62976", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:34207" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.WebPubSub/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Azure.WebPubSub/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..d926ec1f2ff --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.WebPubSub/ValidationAppHost/AppHost.java @@ -0,0 +1,22 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + // addAzureWebPubSub - factory method + var webpubsub = builder.addAzureWebPubSub("webpubsub"); + // addHub - adds a hub to the Web PubSub resource (with optional hubName) + var hub = webpubsub.addHub("myhub"); + var hubWithName = webpubsub.addHub("hub2", "customhub"); + // addEventHandler - adds an event handler to a hub + hub.addEventHandler(ReferenceExpression.refExpr("https://example.com/handler")); + hub.addEventHandler(ReferenceExpression.refExpr("https://example.com/handler2"), new AddEventHandlerOptions().userEventPattern("event1").systemEvents(new String[] { "connect", "connected" })); + // withRoleAssignments - assigns roles on a container resource + var container = builder.addContainer("mycontainer", "mcr.microsoft.com/dotnet/samples:aspnetapp"); + container.withWebPubSubRoleAssignments(webpubsub, new AzureWebPubSubRole[] { AzureWebPubSubRole.WEB_PUB_SUB_SERVICE_OWNER, AzureWebPubSubRole.WEB_PUB_SUB_SERVICE_READER, AzureWebPubSubRole.WEB_PUB_SUB_CONTRIBUTOR }); + // withRoleAssignments - also available directly on AzureWebPubSubResource builder + webpubsub.withWebPubSubRoleAssignments(webpubsub, new AzureWebPubSubRole[] { AzureWebPubSubRole.WEB_PUB_SUB_SERVICE_READER }); + // withReference - generic, works via IResourceWithConnectionString + container.withReference(webpubsub); + container.withReference(hub); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure.WebPubSub/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Azure.WebPubSub/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..bd5ae40cbf5 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure.WebPubSub/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Azure.WebPubSub": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:29550;http://localhost:28731", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10775", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:13119" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Azure/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..27e1b57f5a3 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure/ValidationAppHost/AppHost.java @@ -0,0 +1,83 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + builder.addAzureProvisioning(); + var location = builder.addParameter("location"); + var resourceGroup = builder.addParameter("resource-group"); + var existingName = builder.addParameter("existing-name"); + var existingResourceGroup = builder.addParameter("existing-resource-group"); + var connectionString = builder.addConnectionString("azure-validation", "AZURE_VALIDATION_CONNECTION_STRING"); + var azureEnvironment = builder.addAzureEnvironment(); + azureEnvironment.withLocation(location).withResourceGroup(resourceGroup); + var container = builder.addContainer("api", "mcr.microsoft.com/dotnet/samples:aspnetapp"); + container.withHttpEndpoint(new WithHttpEndpointOptions().name("http").targetPort(8080.0)); + var executable = builder.addExecutable("worker", "dotnet", ".", new String[] { "--info" }); + executable.withHttpEndpoint(new WithHttpEndpointOptions().name("http").targetPort(8081.0)); + var endpoint = container.getEndpoint("http"); + var fileBicep = builder.addBicepTemplate("file-bicep", "./validation.bicep"); + fileBicep.publishAsConnectionString(); + fileBicep.clearDefaultRoleAssignments(); + fileBicep.getBicepIdentifier(); + fileBicep.isExisting(); + fileBicep.runAsExisting("file-bicep-existing", "rg-bicep"); + fileBicep.runAsExistingFromParameters(existingName, existingResourceGroup); + fileBicep.publishAsExisting("file-bicep-existing", "rg-bicep"); + fileBicep.publishAsExistingFromParameters(existingName, existingResourceGroup); + fileBicep.asExisting(existingName, existingResourceGroup); + var inlineBicep = builder.addBicepTemplateString("inline-bicep", """ + output inlineUrl string = "https://inline.example.com" + """); + inlineBicep.publishAsConnectionString(); + inlineBicep.clearDefaultRoleAssignments(); + inlineBicep.getBicepIdentifier(); + inlineBicep.isExisting(); + var infrastructure = builder.addAzureInfrastructure("infra", (infrastructureContext) -> { }); + var infrastructureOutput = infrastructure.getOutput("serviceUrl"); + infrastructureOutput.name(); + infrastructureOutput.value(); + infrastructureOutput.valueExpression(); + infrastructure.withParameter("empty"); + infrastructure.withParameterStringValue("plain", "value"); + infrastructure.withParameterStringValues("list", new String[] { "one", "two" }); + infrastructure.withParameterFromParameter("fromParam", existingName); + infrastructure.withParameterFromConnectionString("fromConnection", connectionString); + infrastructure.withParameterFromOutput("fromOutput", infrastructureOutput); + infrastructure.withParameterFromReferenceExpression("fromExpression", ReferenceExpression.refExpr("https://%s", endpoint)); + infrastructure.withParameterFromEndpoint("fromEndpoint", endpoint); + infrastructure.publishAsConnectionString(); + infrastructure.clearDefaultRoleAssignments(); + infrastructure.getBicepIdentifier(); + infrastructure.isExisting(); + infrastructure.runAsExisting("infra-existing", "rg-infra"); + infrastructure.runAsExistingFromParameters(existingName, existingResourceGroup); + infrastructure.publishAsExisting("infra-existing", "rg-infra"); + infrastructure.publishAsExistingFromParameters(existingName, existingResourceGroup); + infrastructure.asExisting(existingName, existingResourceGroup); + var identity = builder.addAzureUserAssignedIdentity("identity"); + identity.configureInfrastructure((infrastructureContext) -> { }); + identity.withParameter("identityEmpty"); + identity.withParameterStringValue("identityPlain", "value"); + identity.withParameterStringValues("identityList", new String[] { "a", "b" }); + identity.withParameterFromParameter("identityFromParam", existingName); + identity.withParameterFromConnectionString("identityFromConnection", connectionString); + identity.withParameterFromOutput("identityFromOutput", infrastructureOutput); + identity.withParameterFromReferenceExpression("identityFromExpression", ReferenceExpression.refExpr("%s", location)); + identity.withParameterFromEndpoint("identityFromEndpoint", endpoint); + identity.publishAsConnectionString(); + identity.clearDefaultRoleAssignments(); + identity.getBicepIdentifier(); + identity.isExisting(); + identity.runAsExisting("identity-existing", "rg-identity"); + identity.runAsExistingFromParameters(existingName, existingResourceGroup); + identity.publishAsExisting("identity-existing", "rg-identity"); + identity.publishAsExistingFromParameters(existingName, existingResourceGroup); + identity.asExisting(existingName, existingResourceGroup); + container.withEnvironmentFromOutput("INFRA_URL", infrastructureOutput); + container.withEnvironmentFromKeyVaultSecret("SECRET_FROM_IDENTITY", identity); + container.withAzureUserAssignedIdentity(identity); + executable.withEnvironmentFromOutput("INFRA_URL", infrastructureOutput); + executable.withEnvironmentFromKeyVaultSecret("SECRET_FROM_IDENTITY", identity); + executable.withAzureUserAssignedIdentity(identity); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Azure/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Azure/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..2c363f61824 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Azure/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Azure": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:29550;http://localhost:28731", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10775", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:13119" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.DevTunnels/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.DevTunnels/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..78f83de4b96 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.DevTunnels/ValidationAppHost/AppHost.java @@ -0,0 +1,45 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + // Test 1: Basic dev tunnel resource creation (addDevTunnel) + var tunnel = builder.addDevTunnel("mytunnel"); + // Test 2: addDevTunnel with tunnelId option + var tunnel2 = builder.addDevTunnel("mytunnel2", new AddDevTunnelOptions().tunnelId("custom-tunnel-id")); + // Test 3: withAnonymousAccess + builder.addDevTunnel("anon-tunnel") + .withAnonymousAccess(); + // Test 4: Add a container to reference its endpoints + var web = builder.addContainer("web", "nginx"); + web.withHttpEndpoint(new WithHttpEndpointOptions().port(80.0)); + // Test 5: withTunnelReference with EndpointReference (expose a specific endpoint) + var webEndpoint = web.getEndpoint("http"); + tunnel.withTunnelReference(webEndpoint); + // Test 6: withTunnelReferenceAnonymous with EndpointReference + allowAnonymous + var web2 = builder.addContainer("web2", "nginx"); + web2.withHttpEndpoint(new WithHttpEndpointOptions().port(8080.0)); + var web2Endpoint = web2.getEndpoint("http"); + tunnel2.withTunnelReferenceAnonymous(web2Endpoint, true); + // Test 7: withTunnelReferenceAll - expose all endpoints on a resource + var tunnel3 = builder.addDevTunnel("all-endpoints-tunnel"); + var web3 = builder.addContainer("web3", "nginx"); + web3.withHttpEndpoint(new WithHttpEndpointOptions().port(80.0)); + tunnel3.withTunnelReferenceAll(web3, false); + // Test 8: getTunnelEndpoint - get the public tunnel endpoint for a specific endpoint + var web4 = builder.addContainer("web4", "nginx"); + web4.withHttpEndpoint(new WithHttpEndpointOptions().port(80.0)); + var web4Endpoint = web4.getEndpoint("http"); + var tunnel4 = builder.addDevTunnel("get-endpoint-tunnel"); + tunnel4.withTunnelReference(web4Endpoint); + var _tunnelEndpoint = tunnel4.getTunnelEndpoint(web4Endpoint); + // Test 9: addDevTunnel with the dedicated polyglot parameters + var tunnel5 = builder.addDevTunnel("configured-tunnel", new AddDevTunnelOptions().tunnelId("configured-tunnel-id").allowAnonymous(true).description("Configured by the polyglot validation app").labels(new String[] { "validation", "polyglot" })); + var web5 = builder.addContainer("web5", "nginx"); + web5.withHttpEndpoint(new WithHttpEndpointOptions().port(9090.0)); + var web5Endpoint = web5.getEndpoint("http"); + tunnel5.withTunnelReferenceAnonymous(web5Endpoint, true); + // Test 10: Chained configuration + builder.addDevTunnel("chained-tunnel") + .withAnonymousAccess(); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.DevTunnels/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.DevTunnels/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..879c0570e1d --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.DevTunnels/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.DevTunnels": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:29550;http://localhost:28731", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10775", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:13119" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Docker/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Docker/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..5f4d1067162 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Docker/ValidationAppHost/AppHost.java @@ -0,0 +1,43 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + var compose = builder.addDockerComposeEnvironment("compose"); + var api = builder.addContainer("api", "nginx:alpine"); + compose.withProperties((environment) -> { + environment.setDefaultNetworkName("validation-network"); + var _defaultNetworkName = environment.defaultNetworkName(); + environment.setDashboardEnabled(true); + var _dashboardEnabled = environment.dashboardEnabled(); + var _environmentName = environment.name(); + }); + compose.withDashboard(false); + compose.withDashboard(); + compose.configureDashboard((dashboard) -> { + dashboard.withHostPort(18888.0); + dashboard.withForwardedHeaders(true); + var _dashboardName = dashboard.name(); + var primaryEndpoint = dashboard.primaryEndpoint(); + var _primaryUrl = primaryEndpoint.url(); + var _primaryHost = primaryEndpoint.host(); + var _primaryPort = primaryEndpoint.port(); + var otlpGrpcEndpoint = dashboard.otlpGrpcEndpoint(); + var _otlpGrpcUrl = otlpGrpcEndpoint.url(); + var _otlpGrpcPort = otlpGrpcEndpoint.port(); + }); + api.publishAsDockerComposeService((composeService, service) -> { + service.setContainerName("validation-api"); + service.setPullPolicy("always"); + service.setRestart("unless-stopped"); + var _composeServiceName = composeService.name(); + var composeEnvironment = composeService.parent(); + var _composeEnvironmentName = composeEnvironment.name(); + var _serviceContainerName = service.containerName(); + var _servicePullPolicy = service.pullPolicy(); + var _serviceRestart = service.restart(); + }); + var _resolvedDefaultNetworkName = compose.defaultNetworkName(); + var _resolvedDashboardEnabled = compose.dashboardEnabled(); + var _resolvedName = compose.name(); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Docker/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Docker/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..3bfab047c5b --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Docker/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Docker": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:29650;http://localhost:28831", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10875", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:13219" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Foundry/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Foundry/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..e186e2154a1 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Foundry/ValidationAppHost/AppHost.java @@ -0,0 +1,99 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + + var foundry = builder.addFoundry("foundry"); + + var chat = foundry + .addDeployment("chat", "Phi-4", "1", "Microsoft") + .withProperties((deployment) -> { + deployment.setDeploymentName("chat-deployment"); + deployment.setSkuCapacity(10); + var _capacity = deployment.skuCapacity(); + }); + + var model = new FoundryModel(); + model.setName("gpt-4.1-mini"); + model.setVersion("1"); + model.setFormat("OpenAI"); + + var _chatFromModel = foundry.addDeploymentFromModel("chat-from-model", model); + + var localFoundry = builder.addFoundry("local-foundry") + .runAsFoundryLocal(); + + var _localChat = localFoundry.addDeployment("local-chat", "Phi-3.5-mini-instruct", "1", "Microsoft"); + + var registry = builder.addAzureContainerRegistry("registry"); + var keyVault = builder.addAzureKeyVault("vault"); + var appInsights = builder.addAzureApplicationInsights("insights"); + var cosmos = builder.addAzureCosmosDB("cosmos"); + var storage = builder.addAzureStorage("storage"); + + var project = foundry.addProject("project"); + project.withContainerRegistry(registry); + project.withKeyVault(keyVault); + project.withAppInsights(appInsights); + + var _cosmosConnection = project.addCosmosConnection(cosmos); + var _storageConnection = project.addStorageConnection(storage); + var _registryConnection = project.addContainerRegistryConnection(registry); + var _keyVaultConnection = project.addKeyVaultConnection(keyVault); + + var builderProjectFoundry = builder.addFoundry("builder-project-foundry"); + var builderProject = builderProjectFoundry.addProject("builder-project"); + var _builderProjectModel = builderProject.addModelDeployment("builder-project-model", "Phi-4-mini", "1", "Microsoft"); + var projectModel = project.addModelDeploymentFromModel("project-model", model); + var _promptAgent = project.addAndPublishPromptAgent(projectModel, "writer-agent", "Write concise answers."); + var hostedAgent = builder.addExecutable( + "hosted-agent", + "node", + ".", + new String[] { + "-e", + """ +const http = require('node:http'); +const port = Number(process.env.DEFAULT_AD_PORT ?? '8088'); +const server = http.createServer((req, res) => { + if (req.url === '/liveness' || req.url === '/readiness') { + res.writeHead(200, { 'content-type': 'text/plain' }); + res.end('ok'); + return; + } + if (req.url === '/responses') { + res.writeHead(200, { 'content-type': 'application/json' }); + res.end(JSON.stringify({ output: 'hello from validation app host' })); + return; + } + res.writeHead(404); + res.end(); +}); +server.listen(port, '127.0.0.1'); +""" + }); + + hostedAgent.publishAsHostedAgent(new PublishAsHostedAgentOptions() + .project(project) + .configure((configuration) -> { + configuration.setDescription("Validation hosted agent"); + configuration.setCpu(1); + configuration.setMemory(2); + configuration.setMetadata(null); + configuration.setEnvironmentVariables(null); + })); + + var api = builder.addContainer("api", "nginx"); + api.withRoleAssignments(foundry, new FoundryRole[] { + FoundryRole.COGNITIVE_SERVICES_OPEN_AIUSER, + FoundryRole.COGNITIVE_SERVICES_USER + }); + + var _deploymentName = chat.deploymentName(); + var _modelName = chat.modelName(); + var _format = chat.format(); + var _version = chat.modelVersion(); + var _connectionString = chat.connectionStringExpression(); + + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Foundry/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Foundry/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..3979280e633 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Foundry/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Foundry": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:29550;http://localhost:28731", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10775", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:13119" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Garnet/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Garnet/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..94b9e10fc16 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Garnet/ValidationAppHost/AppHost.java @@ -0,0 +1,14 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + var cache = builder.addGarnet("cache"); + // ---- Property access on GarnetResource ---- + var garnet = cache; + var _endpoint = garnet.primaryEndpoint(); + var _host = garnet.host(); + var _port = garnet.port(); + var _uri = garnet.uriExpression(); + var _cstr = garnet.connectionStringExpression(); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Garnet/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Garnet/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..7ff0549f91f --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Garnet/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Garnet": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:29550;http://localhost:28731", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10775", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:13119" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.GitHub.Models/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.GitHub.Models/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..8a86cc4e3ed --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.GitHub.Models/ValidationAppHost/AppHost.java @@ -0,0 +1,24 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + // 1) addGitHubModel - using the GitHubModelName enum + var githubModel = builder.addGitHubModel("chat", GitHubModelName.OPEN_AIGPT4O); + // 2) addGitHubModel - with organization parameter + var orgParam = builder.addParameter("gh-org"); + var githubModelWithOrg = builder.addGitHubModel("chat-org", GitHubModelName.OPEN_AIGPT4O_MINI, orgParam); + // 3) addGitHubModelById - using a model identifier string for models not in the enum + var customModel = builder.addGitHubModelById("custom-chat", "custom-vendor/custom-model"); + // 3) withApiKey - configure a custom API key parameter + var apiKey = builder.addParameter("gh-api-key", true); + githubModel.withApiKey(apiKey); + // 4) enableHealthCheck - integration-specific no-args health check + githubModel.enableHealthCheck(); + // 5) withReference - pass GitHubModelResource as a connection string source to a container + var container = builder.addContainer("my-service", "mcr.microsoft.com/dotnet/samples:latest"); + container.withReference(githubModel); + // 6) withReference - pass GitHubModelResource as a source to another container with custom connection name + container.withReference(githubModelWithOrg, new WithReferenceOptions().connectionName("github-model-org")); + var app = builder.build(); + app.run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.GitHub.Models/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.GitHub.Models/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..7f96ab53a8f --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.GitHub.Models/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.GitHub.Models": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:29550;http://localhost:28731", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10775", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:13119" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.JavaScript/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.JavaScript/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..fdebcee8d5f --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.JavaScript/ValidationAppHost/AppHost.java @@ -0,0 +1,20 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + var nodeApp = builder.addNodeApp("node-app", "./node-app", "server.js"); + nodeApp.withNpm(new WithNpmOptions().install(false).installCommand("install").installArgs(new String[] { "--ignore-scripts" })); + nodeApp.withBun(new WithBunOptions().install(false).installArgs(new String[] { "--frozen-lockfile" })); + nodeApp.withYarn(new WithYarnOptions().install(false).installArgs(new String[] { "--immutable" })); + nodeApp.withPnpm(new WithPnpmOptions().install(false).installArgs(new String[] { "--frozen-lockfile" })); + nodeApp.withBuildScript("build", new String[] { "--mode", "production" }); + nodeApp.withRunScript("dev", new String[] { "--host", "0.0.0.0" }); + var javaScriptApp = builder.addJavaScriptApp("javascript-app", "./javascript-app", "start"); + javaScriptApp.withEnvironment("NODE_ENV", "development"); + var viteApp = builder.addViteApp("vite-app", "./vite-app", "dev"); + viteApp.withViteConfig("./vite.custom.config.ts"); + viteApp.withPnpm(new WithPnpmOptions().install(false).installArgs(new String[] { "--prod" })); + viteApp.withBuildScript("build", new String[] { "--mode", "production" }); + viteApp.withRunScript("dev", new String[] { "--host" }); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.JavaScript/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.JavaScript/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..f9922f6986f --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.JavaScript/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.JavaScript": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:29670;http://localhost:28851", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10895", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:13239" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Kafka/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Kafka/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..fc0953afe5e --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Kafka/ValidationAppHost/AppHost.java @@ -0,0 +1,26 @@ +import aspire.*; + +void main() throws Exception { + // Aspire TypeScript AppHost - Kafka integration validation + // Exercises all [AspireExport] methods for Aspire.Hosting.Kafka + var builder = DistributedApplication.CreateBuilder(); + // addKafka - factory method with optional port + var kafka = builder.addKafka("broker"); + // withKafkaUI - adds Kafka UI management container with callback + var kafkaWithUi = kafka.withKafkaUI(new WithKafkaUIOptions().configureContainer((ui) -> { + // withHostPort - sets the host port for Kafka UI + ui.withHostPort(9000.0); + }).containerName("my-kafka-ui")); + // withDataVolume - adds a data volume + kafkaWithUi.withDataVolume(); + // withDataBindMount - adds a data bind mount + var kafka2 = builder.addKafka("broker2", 19092.0); + kafka2.withDataBindMount("/tmp/kafka-data"); + // ---- Property access on KafkaServerResource ---- + var _endpoint = kafka.primaryEndpoint(); + var _host = kafka.host(); + var _port = kafka.port(); + var _internal = kafka.internalEndpoint(); + var _cstr = kafka.connectionStringExpression(); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Kafka/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Kafka/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..76090606dc0 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Kafka/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Kafka": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:16114;http://localhost:53304", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:18137", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:39824" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Keycloak/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Keycloak/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..77a9f594d78 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Keycloak/ValidationAppHost/AppHost.java @@ -0,0 +1,27 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + var adminUsername = builder.addParameter("keycloak-admin-user"); + var adminPassword = builder.addParameter("keycloak-admin-password", true); + var keycloak = builder.addKeycloak("keycloak", new AddKeycloakOptions().port(8080.0)); + keycloak + .withDataVolume("keycloak-data") + .withRealmImport(".") + .withEnabledFeatures(new String[] { "token-exchange", "opentelemetry" }) + .withDisabledFeatures(new String[] { "admin-fine-grained-authz" }) + .withOtlpExporter(); + var keycloak2 = builder.addKeycloak("keycloak2") + .withDataBindMount(".") + .withRealmImport(".") + .withEnabledFeatures(new String[] { "rolling-updates" }) + .withDisabledFeatures(new String[] { "scripts" }) + .withOtlpExporterWithProtocol(OtlpProtocol.HTTP_PROTOBUF); + var consumer = builder.addContainer("consumer", "nginx"); + consumer.withReference(keycloak); + consumer.withReference(keycloak2); + var _keycloakName = keycloak.name(); + var _keycloakEntrypoint = keycloak.entrypoint(); + var _keycloakShellExecution = keycloak.shellExecution(); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Keycloak/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Keycloak/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..3620ced071a --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Keycloak/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Keycloak": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:44486;http://localhost:17648", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:12771", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:44457" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Kubernetes/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Kubernetes/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..5c2bc9e91d4 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Kubernetes/ValidationAppHost/AppHost.java @@ -0,0 +1,36 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + var kubernetes = builder.addKubernetesEnvironment("kube"); + kubernetes.withProperties((environment) -> { + environment.setHelmChartName("validation-kubernetes"); + var _configuredHelmChartName = environment.helmChartName(); + environment.setHelmChartVersion("1.2.3"); + var _configuredHelmChartVersion = environment.helmChartVersion(); + environment.setHelmChartDescription("Validation Helm Chart"); + var _configuredHelmChartDescription = environment.helmChartDescription(); + environment.setDefaultStorageType("pvc"); + var _configuredDefaultStorageType = environment.defaultStorageType(); + environment.setDefaultStorageClassName("fast-storage"); + var _configuredDefaultStorageClassName = environment.defaultStorageClassName(); + environment.setDefaultStorageSize("5Gi"); + var _configuredDefaultStorageSize = environment.defaultStorageSize(); + environment.setDefaultStorageReadWritePolicy("ReadWriteMany"); + var _configuredDefaultStorageReadWritePolicy = environment.defaultStorageReadWritePolicy(); + environment.setDefaultImagePullPolicy("Always"); + var _configuredDefaultImagePullPolicy = environment.defaultImagePullPolicy(); + environment.setDefaultServiceType("LoadBalancer"); + var _configuredDefaultServiceType = environment.defaultServiceType(); + }); + var _resolvedHelmChartName = kubernetes.helmChartName(); + var _resolvedDefaultStorageClassName = kubernetes.defaultStorageClassName(); + var _resolvedDefaultServiceType = kubernetes.defaultServiceType(); + var serviceContainer = builder.addContainer("kube-service", "redis:alpine"); + serviceContainer.publishAsKubernetesService((service) -> { + var _serviceName = service.name(); + var serviceParent = service.parent(); + var _serviceParentChartName = serviceParent.helmChartName(); + }); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Kubernetes/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Kubernetes/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..00131712eb8 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Kubernetes/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Kubernetes": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:29650;http://localhost:28831", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10875", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:13219" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Maui/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Maui/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..bdeb7f0e0e4 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Maui/ValidationAppHost/AppHost.java @@ -0,0 +1,16 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + var maui = builder.addMauiProject( + "mauiapp", + "../../../../AspireWithMaui/AspireWithMaui.MauiClient/AspireWithMaui.MauiClient.csproj" + ); + maui.addWindowsDevice("mauiapp-windows").withOtlpDevTunnel(); + maui.addMacCatalystDevice("mauiapp-maccatalyst").withOtlpDevTunnel(); + maui.addAndroidDevice("mauiapp-android-device", "emulator-5554").withOtlpDevTunnel(); + maui.addAndroidEmulator("mauiapp-android-emulator", "Pixel_9_API_35").withOtlpDevTunnel(); + maui.addiOSDevice("mauiapp-ios-device", "00008030-001234567890123A").withOtlpDevTunnel(); + maui.addiOSSimulator("mauiapp-ios-simulator", "E25BBE37-69BA-4720-B6FD-D54C97791E79").withOtlpDevTunnel(); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Maui/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Maui/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..2a75853a712 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Maui/ValidationAppHost/aspire.config.json @@ -0,0 +1,24 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Maui": "" + }, + "profiles": { + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "https://localhost:17001;http://localhost:17000", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:17003", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:17004" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Milvus/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Milvus/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..b4cf4e7e3bb --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Milvus/ValidationAppHost/AppHost.java @@ -0,0 +1,59 @@ +import aspire.*; + +void main() throws Exception { + // Aspire TypeScript AppHost - Milvus integration validation + // Exercises every exported member of Aspire.Hosting.Milvus + var builder = DistributedApplication.CreateBuilder(); + // ── 1. addMilvus: basic Milvus server resource ───────────────────────────── + var milvus = builder.addMilvus("milvus"); + // ── 2. addMilvus: with custom apiKey parameter ───────────────────────────── + var customKey = builder.addParameter("milvus-key", true); + var milvus2 = builder.addMilvus("milvus2", new AddMilvusOptions().apiKey(customKey)); + // ── 3. addMilvus: with explicit gRPC port ────────────────────────────────── + builder.addMilvus("milvus3", new AddMilvusOptions().grpcPort(19531.0)); + // ── 4. addDatabase: add database to Milvus server ────────────────────────── + var db = milvus.addDatabase("mydb"); + // ── 5. addDatabase: with custom database name ────────────────────────────── + milvus.addDatabase("db2", "customdb"); + // ── 6. withAttu: add Attu administration tool ────────────────────────────── + milvus.withAttu(); + // ── 7. withAttu: with container name ──────────────────────────────────────── + milvus2.withAttu(new WithAttuOptions().containerName("my-attu")); + // ── 8. withAttu: with configureContainer callback ────────────────────────── + builder.addMilvus("milvus-attu-cfg") + .withAttu(new WithAttuOptions().configureContainer((container) -> { + container.withHttpEndpoint(new WithHttpEndpointOptions().port(3001.0)); + })); + // ── 9. withDataVolume: persistent data volume ────────────────────────────── + milvus.withDataVolume(); + // ── 10. withDataVolume: with custom name ──────────────────────────────────── + milvus2.withDataVolume(new WithDataVolumeOptions().name("milvus-data")); + // ── 11. withDataBindMount: bind mount for data ───────────────────────────── + builder.addMilvus("milvus-bind") + .withDataBindMount("./milvus-data"); + // ── 12. withDataBindMount: with read-only flag ───────────────────────────── + builder.addMilvus("milvus-bind-ro") + .withDataBindMount("./milvus-data-ro", true); + // ── 13. withConfigurationFile: custom milvus.yaml ────────────────────────── + builder.addMilvus("milvus-cfg") + .withConfigurationFile("./milvus.yaml"); + // ── 14. Fluent chaining: multiple With* methods ──────────────────────────── + var milvusChained = builder.addMilvus("milvus-chained"); + milvusChained.withLifetime(ContainerLifetime.PERSISTENT); + milvusChained.withDataVolume(new WithDataVolumeOptions().name("milvus-chained-data")); + milvusChained.withAttu(); + // ── 15. withReference: use Milvus database from a container resource ─────── + var api = builder.addContainer("api", "myregistry/myapp"); + api.withReference(db); + // ── 16. withReference: use Milvus server directly ────────────────────────── + api.withReference(milvus); + // ---- Property access on MilvusServerResource ---- + var _endpoint = milvus.primaryEndpoint(); + var _host = milvus.host(); + var _port = milvus.port(); + var _token = milvus.token(); + var _uri = milvus.uriExpression(); + var _cstr = milvus.connectionStringExpression(); + var _databases = milvus.databases(); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Milvus/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Milvus/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..5185498c421 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Milvus/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Milvus": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:29550;http://localhost:28731", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10775", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:13119" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.MongoDB/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.MongoDB/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..ef7f2095493 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.MongoDB/ValidationAppHost/AppHost.java @@ -0,0 +1,47 @@ +import aspire.*; + +void main() throws Exception { + // Aspire TypeScript AppHost + // For more information, see: https://aspire.dev + var builder = DistributedApplication.CreateBuilder(); + // Test 1: Basic MongoDB resource creation (addMongoDB) + var mongo = builder.addMongoDB("mongo"); + // Test 2: Add database to MongoDB (addDatabase) + mongo.addDatabase("mydb"); + // Test 3: Add database with custom database name + mongo.addDatabase("db2", "customdb2"); + // Test 4: Test withDataVolume + builder.addMongoDB("mongo-volume") + .withDataVolume(); + // Test 5: Test withDataVolume with custom name + builder.addMongoDB("mongo-volume-named") + .withDataVolume(new WithDataVolumeOptions().name("mongo-data")); + // Test 6: Test withHostPort on MongoExpress + builder.addMongoDB("mongo-express") + .withMongoExpress(new WithMongoExpressOptions().configureContainer((container) -> { + container.withHostPort(8082.0); + })); + // Test 7: Test withMongoExpress with container name + builder.addMongoDB("mongo-express-named") + .withMongoExpress(new WithMongoExpressOptions().containerName("my-mongo-express")); + // Test 8: Custom password parameter with addParameter + var customPassword = builder.addParameter("mongo-password", true); + builder.addMongoDB("mongo-custom-pass", new AddMongoDBOptions().password(customPassword)); + // Test 9: Chained configuration - multiple With* methods + var mongoChained = builder.addMongoDB("mongo-chained"); + mongoChained.withLifetime(ContainerLifetime.PERSISTENT); + mongoChained.withDataVolume(new WithDataVolumeOptions().name("mongo-chained-data")); + // Test 10: Add multiple databases to same server + mongoChained.addDatabase("app-db"); + mongoChained.addDatabase("analytics-db", "analytics"); + // ---- Property access on MongoDBServerResource ---- + var _endpoint = mongo.primaryEndpoint(); + var _host = mongo.host(); + var _port = mongo.port(); + var _uri = mongo.uriExpression(); + var _userName = mongo.userNameReference(); + // Build and run the app + var _cstr = mongo.connectionStringExpression(); + var _databases = mongo.databases(); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.MongoDB/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.MongoDB/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..dc8f5a1e6ff --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.MongoDB/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.MongoDB": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:29550;http://localhost:28731", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10775", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:13119" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.MySql/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.MySql/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..98d1b8e913d --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.MySql/ValidationAppHost/AppHost.java @@ -0,0 +1,26 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + var rootPassword = builder.addParameter("mysql-root-password", true); + var mysql = builder.addMySql("mysql", new AddMySqlOptions().password(rootPassword).port(3306.0)); + mysql + .withPassword(rootPassword) + .withDataVolume(new WithDataVolumeOptions().name("mysql-data")) + .withDataBindMount(".", true) + .withInitFiles("."); + mysql.withPhpMyAdmin(new WithPhpMyAdminOptions().containerName("phpmyadmin").configureContainer((container) -> { + container.withHostPort(8080.0); + })); + var db = mysql.addDatabase("appdb", "appdb"); + db.withCreationScript("CREATE DATABASE IF NOT EXISTS appdb;"); + // ---- Property access on MySqlServerResource ---- + var _endpoint = mysql.primaryEndpoint(); + var _host = mysql.host(); + var _port = mysql.port(); + var _uri = mysql.uriExpression(); + var _jdbc = mysql.jdbcConnectionString(); + var _cstr = mysql.connectionStringExpression(); + var _databases = mysql.databases(); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.MySql/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.MySql/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..6de80ace28e --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.MySql/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.MySql": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:29550;http://localhost:28731", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10775", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:13119" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Nats/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Nats/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..3119965b194 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Nats/ValidationAppHost/AppHost.java @@ -0,0 +1,38 @@ +import aspire.*; + +void main() throws Exception { + // Aspire TypeScript AppHost - NATS integration validation + // Exercises all [AspireExport] methods for Aspire.Hosting.Nats + var builder = DistributedApplication.CreateBuilder(); + // addNats - factory method with default options + var nats = builder.addNats("messaging"); + // withJetStream - enable JetStream support + nats.withJetStream(); + // withDataVolume - add persistent data volume + nats.withDataVolume(); + // withDataVolume - with custom name and readOnly option + var nats2 = builder.addNats("messaging2", new AddNatsOptions().port(4223.0)) + .withJetStream() + .withDataVolume(new WithDataVolumeOptions().name("nats-data").isReadOnly(false)) + .withLifetime(ContainerLifetime.PERSISTENT); + // withDataBindMount - bind mount a host directory + var nats3 = builder.addNats("messaging3"); + nats3.withDataBindMount("/tmp/nats-data"); + // addNats - with custom userName and password parameters + var customUser = builder.addParameter("nats-user"); + var customPass = builder.addParameter("nats-pass", true); + var nats4 = builder.addNats("messaging4", new AddNatsOptions().userName(customUser).password(customPass)); + // withReference - a container referencing a NATS resource (connection string) + var consumer = builder.addContainer("consumer", "myimage"); + consumer.withReference(nats); + // withReference - with explicit connection name option + consumer.withReference(nats4, new WithReferenceOptions().connectionName("messaging4-connection")); + // ---- Property access on NatsServerResource ---- + var _endpoint = nats.primaryEndpoint(); + var _host = nats.host(); + var _port = nats.port(); + var _uri = nats.uriExpression(); + var _userName = nats.userNameReference(); + var _cstr = nats.connectionStringExpression(); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Nats/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Nats/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..a0c1f0dd32b --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Nats/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Nats": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:29550;http://localhost:28731", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10775", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:13119" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.OpenAI/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.OpenAI/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..bad331d1c17 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.OpenAI/ValidationAppHost/AppHost.java @@ -0,0 +1,11 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + var apiKey = builder.addParameter("openai-api-key", true); + var openai = builder.addOpenAI("openai") + .withEndpoint("https://api.openai.com/v1") + .withApiKey(apiKey); + openai.addModel("chat-model", "gpt-4o-mini"); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.OpenAI/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.OpenAI/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..8aa47c8ebc9 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.OpenAI/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.OpenAI": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:29550;http://localhost:28731", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10775", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:13119" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Oracle/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Oracle/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..cfe27d1f183 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Oracle/ValidationAppHost/AppHost.java @@ -0,0 +1,54 @@ +import aspire.*; + +void main() throws Exception { + // Aspire TypeScript AppHost - Oracle Integration Validation + // Validates all [AspireExport] methods for Aspire.Hosting.Oracle + var builder = DistributedApplication.CreateBuilder(); + // ---- addOracle: factory method with defaults ---- + var oracle = builder.addOracle("oracledb"); + // ---- addOracle: factory method with custom password and port ---- + var customPassword = builder.addParameter("oracle-password", true); + var oracle2 = builder.addOracle("oracledb2", new AddOracleOptions().password(customPassword).port(1522.0)); + // ---- addDatabase: child resource with default databaseName ---- + var db = oracle.addDatabase("mydb"); + // ---- addDatabase: child resource with explicit databaseName ---- + var db2 = oracle.addDatabase("inventory", "inventorydb"); + // ---- withDataVolume: data persistence (default name) ---- + oracle.withDataVolume(); + // ---- withDataVolume: data persistence (custom name) ---- + oracle2.withDataVolume("oracle-data"); + // ---- withDataBindMount: bind mount for data ---- + oracle2.withDataBindMount("./oracle-data"); + // ---- withInitFiles: initialization scripts ---- + oracle2.withInitFiles("./init-scripts"); + // ---- withDbSetupBindMount: DB setup directory ---- + oracle2.withDbSetupBindMount("./setup-scripts"); + // ---- withReference: connection string reference (from core) ---- + var otherOracle = builder.addOracle("other-oracle"); + var otherDb = otherOracle.addDatabase("otherdb"); + oracle.withReference(otherDb); + // ---- withReference: with connection name option ---- + oracle.withReference(otherDb, new WithReferenceOptions().connectionName("secondary-db")); + // ---- withReference: unified reference to another Oracle server resource ---- + oracle.withReference(otherOracle); + // ---- Fluent chaining: multiple methods chained ---- + var oracle3 = builder.addOracle("oracledb3"); + oracle3.withLifetime(ContainerLifetime.PERSISTENT); + oracle3.withDataVolume("oracle3-data"); + oracle3.addDatabase("chaineddb"); + // ---- Property access on OracleDatabaseServerResource ---- + var _endpoint = oracle.primaryEndpoint(); + var _host = oracle.host(); + var _port = oracle.port(); + var _userNameRef = oracle.userNameReference(); + var _uri = oracle.uriExpression(); + var _jdbc = oracle.jdbcConnectionString(); + var _cstr = oracle.connectionStringExpression(); + // ---- Property access on OracleDatabaseResource ---- + var _dbName = db.databaseName(); + var _dbUri = db.uriExpression(); + var _dbJdbc = db.jdbcConnectionString(); + var _dbParent = db.parent(); + var _dbCstr = db.connectionStringExpression(); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Oracle/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Oracle/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..f4ee67bdd05 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Oracle/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Oracle": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:29550;http://localhost:28731", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10775", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:13119" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Orleans/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Orleans/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..185a8452a3b --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Orleans/ValidationAppHost/AppHost.java @@ -0,0 +1,25 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + var provider = builder.addConnectionString("provider", "ORLEANS_PROVIDER_CONNECTION_STRING"); + var orleans = builder.addOrleans("orleans") + .withClusterId("cluster-id") + .withServiceId("service-id") + .withClustering(provider) + .withDevelopmentClustering() + .withGrainStorage("grain-storage", provider) + .withMemoryGrainStorage("memory-grain-storage") + .withStreaming("streaming", provider) + .withMemoryStreaming("memory-streaming") + .withBroadcastChannel("broadcast") + .withReminders(provider) + .withMemoryReminders() + .withGrainDirectory("grain-directory", provider); + var orleansClient = orleans.asClient(); + var silo = builder.addContainer("silo", "redis"); + silo.withOrleansReference(orleans); + var client = builder.addContainer("client", "redis"); + client.withOrleansClientReference(orleansClient); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Orleans/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Orleans/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..a302e061f31 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Orleans/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Orleans": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:29550;http://localhost:28731", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10775", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:13119" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.PostgreSQL/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.PostgreSQL/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..8869ed9c00e --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.PostgreSQL/ValidationAppHost/AppHost.java @@ -0,0 +1,47 @@ +import aspire.*; + +void main() throws Exception { + // Aspire TypeScript AppHost - PostgreSQL Integration Validation + // Validates all [AspireExport] methods for Aspire.Hosting.PostgreSQL + var builder = DistributedApplication.CreateBuilder(); + // ---- AddPostgres: factory method ---- + var postgres = builder.addPostgres("pg"); + // ---- AddDatabase: child resource ---- + var db = postgres.addDatabase("mydb", "testdb"); + // ---- WithPgAdmin: management UI ---- + postgres.withPgAdmin(); + postgres.withPgAdmin(new WithPgAdminOptions().containerName("mypgadmin")); + // ---- WithPgWeb: management UI ---- + postgres.withPgWeb(); + postgres.withPgWeb(new WithPgWebOptions().containerName("mypgweb")); + // ---- WithDataVolume: data persistence ---- + postgres.withDataVolume(); + postgres.withDataVolume(new WithDataVolumeOptions().name("pg-data").isReadOnly(false)); + // ---- WithDataBindMount: bind mount ---- + postgres.withDataBindMount("./data"); + postgres.withDataBindMount("./data2", true); + // ---- WithInitFiles: initialization scripts ---- + postgres.withInitFiles("./init"); + // ---- WithHostPort: explicit port for PostgreSQL ---- + postgres.withHostPort(5432.0); + // ---- WithCreationScript: custom database creation SQL ---- + db.withCreationScript("CREATE DATABASE \"testdb\""); + // ---- WithPassword / WithUserName: credential configuration ---- + var customPassword = builder.addParameter("pg-password", true); + var customUser = builder.addParameter("pg-user"); + var pg2 = builder.addPostgres("pg2"); + pg2.withPassword(customPassword); + pg2.withUserName(customUser); + // ---- Property access on PostgresServerResource ---- + var _endpoint = postgres.primaryEndpoint(); + var _nameRef = postgres.userNameReference(); + var _uri = postgres.uriExpression(); + var _jdbc = postgres.jdbcConnectionString(); + var _cstr = postgres.connectionStringExpression(); + // ---- Property access on PostgresDatabaseResource ---- + var _dbName = db.databaseName(); + var _dbUri = db.uriExpression(); + var _dbJdbc = db.jdbcConnectionString(); + var _dbCstr = db.connectionStringExpression(); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.PostgreSQL/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.PostgreSQL/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..a64428ed582 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.PostgreSQL/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.PostgreSQL": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:33490;http://localhost:28305", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:21575", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:17364" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Python/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Python/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..6d0011fd9b9 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Python/ValidationAppHost/AppHost.java @@ -0,0 +1,15 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + builder.addPythonApp("python-script", ".", "main.py"); + builder.addPythonModule("python-module", ".", "uvicorn"); + builder.addPythonExecutable("python-executable", ".", "pytest"); + var uvicorn = builder.addUvicornApp("python-uvicorn", ".", "main:app"); + uvicorn.withVirtualEnvironment(".venv", false); + uvicorn.withDebugging(); + uvicorn.withEntrypoint(EntrypointType.MODULE, "uvicorn"); + uvicorn.withPip(new WithPipOptions().install(true).installArgs(new String[] { "install", "-r", "requirements.txt" })); + uvicorn.withUv(new WithUvOptions().install(false).args(new String[] { "sync" })); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Python/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Python/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..db5811de5c2 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Python/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Python": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:29550;http://localhost:28731", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10775", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:13119" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Qdrant/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Qdrant/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..3ae21ca5d4d --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Qdrant/ValidationAppHost/AppHost.java @@ -0,0 +1,22 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + var customApiKey = builder.addParameter("qdrant-key", true); + builder.addQdrant("qdrant-custom", new AddQdrantOptions().apiKey(customApiKey).grpcPort(16334.0).httpPort(16333.0)); + var qdrant = builder.addQdrant("qdrant"); + qdrant.withDataVolume(new WithDataVolumeOptions().name("qdrant-data")).withDataBindMount(".", true); + var consumer = builder.addContainer("consumer", "busybox"); + consumer.withReference(qdrant, new WithReferenceOptions().connectionName("qdrant")); + // ---- Property access on QdrantServerResource ---- + var _endpoint = qdrant.primaryEndpoint(); + var _grpcHost = qdrant.grpcHost(); + var _grpcPort = qdrant.grpcPort(); + var _httpEndpoint = qdrant.httpEndpoint(); + var _httpHost = qdrant.httpHost(); + var _httpPort = qdrant.httpPort(); + var _uri = qdrant.uriExpression(); + var _httpUri = qdrant.httpUriExpression(); + var _cstr = qdrant.connectionStringExpression(); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Qdrant/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Qdrant/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..e667f37283e --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Qdrant/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Qdrant": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:29550;http://localhost:28731", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10775", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:13119" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.RabbitMQ/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.RabbitMQ/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..aab4084ab29 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.RabbitMQ/ValidationAppHost/AppHost.java @@ -0,0 +1,21 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + var rabbitmq = builder.addRabbitMQ("messaging"); + rabbitmq.withDataVolume(); + rabbitmq.withManagementPlugin(); + var rabbitmq2 = builder.addRabbitMQ("messaging2"); + rabbitmq2.withLifetime(ContainerLifetime.PERSISTENT); + rabbitmq2.withDataVolume(); + rabbitmq2.withManagementPluginWithPort(15673.0); + // ---- Property access on RabbitMQServerResource ---- + var _endpoint = rabbitmq.primaryEndpoint(); + var _mgmtEndpoint = rabbitmq.managementEndpoint(); + var _host = rabbitmq.host(); + var _port = rabbitmq.port(); + var _uri = rabbitmq.uriExpression(); + var _userName = rabbitmq.userNameReference(); + var _cstr = rabbitmq.connectionStringExpression(); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.RabbitMQ/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.RabbitMQ/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..8984f7abaed --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.RabbitMQ/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.RabbitMQ": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:18076;http://localhost:48822", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:56384", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:64883" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Redis/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Redis/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..ec6d87baa10 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Redis/ValidationAppHost/AppHost.java @@ -0,0 +1,39 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + // addRedis - full overload with port and password parameter + var password = builder.addParameter("redis-password", true); + var cache = builder.addRedis("cache", new AddRedisOptions().password(password)); + // addRedisWithPort - overload with explicit port + var cache2 = builder.addRedisWithPort("cache2", 6380.0); + // withDataVolume + withPersistence - fluent chaining on RedisResource + cache.withDataVolume(new WithDataVolumeOptions().name("redis-data")); + cache.withPersistence(new WithPersistenceOptions().interval(600000000.0).keysChangedThreshold(5.0)); + // withDataBindMount on RedisResource + cache2.withDataBindMount("/tmp/redis-data"); + // withHostPort on RedisResource + cache.withHostPort(6379.0); + // withPassword on RedisResource + var newPassword = builder.addParameter("new-redis-password", true); + cache2.withPassword(newPassword); + // withRedisCommander - with configureContainer callback exercising withHostPort + cache.withRedisCommander(new WithRedisCommanderOptions().configureContainer((commander) -> { + commander.withHostPort(8081.0); + }).containerName("my-commander")); + // withRedisInsight - with configureContainer callback exercising withHostPort, withDataVolume, withDataBindMount + cache.withRedisInsight(new WithRedisInsightOptions().configureContainer((insight) -> { + insight.withHostPort(5540.0); + insight.withDataVolume("insight-data"); + insight.withDataBindMount("/tmp/insight-data"); + }).containerName("my-insight")); + // ---- Property access on RedisResource (ExposeProperties = true) ---- + var redis = cache; + var _endpoint = redis.primaryEndpoint(); + var _host = redis.host(); + var _port = redis.port(); + var _tlsEnabled = redis.tlsEnabled(); + var _uri = redis.uriExpression(); + var _cstr = redis.connectionStringExpression(); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Redis/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Redis/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..6c49cdabaac --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Redis/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Redis": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:29650;http://localhost:28831", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10875", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:13219" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Seq/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Seq/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..617c472577a --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Seq/ValidationAppHost/AppHost.java @@ -0,0 +1,17 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + var adminPassword = builder.addParameter("seq-admin-password", true); + var seq = builder.addSeq("seq", adminPassword, 5341.0); + seq.withDataVolume(); + seq.withDataVolume(new WithDataVolumeOptions().name("seq-data").isReadOnly(false)); + seq.withDataBindMount("./seq-data", true); + // ---- Property access on SeqResource ---- + var _endpoint = seq.primaryEndpoint(); + var _host = seq.host(); + var _port = seq.port(); + var _uri = seq.uriExpression(); + var _cstr = seq.connectionStringExpression(); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Seq/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Seq/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..5db1ee9e93f --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Seq/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Seq": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:29550;http://localhost:28731", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10775", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:13119" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.SqlServer/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.SqlServer/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..e5f5d86e951 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.SqlServer/ValidationAppHost/AppHost.java @@ -0,0 +1,37 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + // Test 1: Basic SQL Server resource creation (addSqlServer) + var sqlServer = builder.addSqlServer("sql"); + // Test 2: Add database to SQL Server (addDatabase) + sqlServer.addDatabase("mydb"); + // Test 3: Test withDataVolume + builder.addSqlServer("sql-volume") + .withDataVolume(); + // Test 4: Test withHostPort + builder.addSqlServer("sql-port") + .withHostPort(11433.0); + // Test 5: Test password parameter with addParameter + var customPassword = builder.addParameter("sql-password", true); + builder.addSqlServer("sql-custom-pass", new AddSqlServerOptions().password(customPassword)); + // Test 6: Chained configuration - multiple With* methods + var sqlChained = builder.addSqlServer("sql-chained"); + sqlChained.withLifetime(ContainerLifetime.PERSISTENT); + sqlChained.withDataVolume(new WithDataVolumeOptions().name("sql-chained-data")); + sqlChained.withHostPort(12433.0); + // Test 7: Add multiple databases to same server + sqlChained.addDatabase("db1"); + sqlChained.addDatabase("db2", "customdb2"); + // ---- Property access on SqlServerServerResource ---- + var _endpoint = sqlServer.primaryEndpoint(); + var _host = sqlServer.host(); + var _port = sqlServer.port(); + var _uri = sqlServer.uriExpression(); + var _jdbc = sqlServer.jdbcConnectionString(); + var _userName = sqlServer.userNameReference(); + // Build and run the app + var _cstr = sqlServer.connectionStringExpression(); + var _databases = sqlServer.databases(); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.SqlServer/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.SqlServer/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..7fbce57a6be --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.SqlServer/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.SqlServer": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:55686;http://localhost:57768", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:51980", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:28684" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Valkey/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Valkey/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..29dd1ab8cd1 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Valkey/ValidationAppHost/AppHost.java @@ -0,0 +1,18 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + var password = builder.addParameter("valkey-password", true); + var valkey = builder.addValkey("cache", new AddValkeyOptions().port(6380.0)); + valkey + .withDataVolume(new WithDataVolumeOptions().name("valkey-data")) + .withDataBindMount(".", true) + .withPersistence(new WithPersistenceOptions().interval(100000000.0).keysChangedThreshold(1.0)); + // ---- Property access on ValkeyResource ---- + var _endpoint = valkey.primaryEndpoint(); + var _host = valkey.host(); + var _port = valkey.port(); + var _uri = valkey.uriExpression(); + var _cstr = valkey.connectionStringExpression(); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Valkey/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Valkey/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..baecdf88964 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Valkey/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Valkey": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:29550;http://localhost:28731", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10775", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:13119" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting.Yarp/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting.Yarp/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..d89b8ec433b --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Yarp/ValidationAppHost/AppHost.java @@ -0,0 +1,134 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + var buildVersion = builder.addParameterFromConfiguration("buildVersion", "MyConfig:BuildVersion"); + var buildSecret = builder.addParameterFromConfiguration("buildSecret", "MyConfig:Secret", true); + var staticFilesSource = builder.addContainer("static-files-source", "nginx"); + var backend = builder.addContainer("backend", "nginx"); + backend.withHttpEndpoint(new WithHttpEndpointOptions().name("http").targetPort(80.0)); + var externalBackend = builder.addExternalService("external-backend", "https://example.com"); + var proxy = builder.addYarp("proxy"); + proxy.withHostPort(8080.0); + proxy.withHostHttpsPort(8443.0); + proxy.withEndpointProxySupport(true); + proxy.withDockerfile("./context"); + proxy.withImageSHA256("abc123def456"); + proxy.withContainerNetworkAlias("myalias"); + proxy.publishAsContainer(); + proxy.publishWithStaticFiles(staticFilesSource); + proxy.withVolume("/data", new WithVolumeOptions().name("proxy-data")); + proxy.withBuildArg("BUILD_VERSION", buildVersion); + proxy.withBuildSecret("MY_SECRET", buildSecret); + proxy.withConfiguration((config) -> { + var endpoint = backend.getEndpoint("http"); + var backendService = backend; + var endpointCluster = config.addClusterFromEndpoint(endpoint); + var resourceCluster = config.addClusterFromResource(backendService); + var externalServiceCluster = config.addClusterFromExternalService(externalBackend); + var singleDestinationCluster = config.addClusterWithDestination("single-destination", "https://example.net"); + var multiDestinationCluster = config.addClusterWithDestinations("multi-destination", new String[] { "https://example.org", "https://example.edu" }); + var routeFromEndpoint = config.addRouteFromEndpoint("/from-endpoint/{**catchall}", endpoint); + var routeFromResource = config.addRouteFromResource("/from-resource/{**catchall}", backendService); + var routeFromExternalService = config.addRouteFromExternalService("/from-external/{**catchall}", externalBackend); + var catchAllRoute = config.addCatchAllRoute(endpointCluster); + var catchAllRouteFromEndpoint = config.addCatchAllRouteFromEndpoint(endpoint); + var catchAllRouteFromResource = config.addCatchAllRouteFromResource(backendService); + var catchAllRouteFromExternalService = config.addCatchAllRouteFromExternalService(externalBackend); + + var forwarderRequestConfig = new YarpForwarderRequestConfig(); + forwarderRequestConfig.setActivityTimeout(30_000_000.0); + forwarderRequestConfig.setAllowResponseBuffering(true); + forwarderRequestConfig.setVersion("2.0"); + endpointCluster.withForwarderRequestConfig(forwarderRequestConfig); + + var httpClientConfig = new YarpHttpClientConfig(); + httpClientConfig.setDangerousAcceptAnyServerCertificate(true); + httpClientConfig.setEnableMultipleHttp2Connections(true); + httpClientConfig.setMaxConnectionsPerServer(10); + httpClientConfig.setRequestHeaderEncoding("utf-8"); + httpClientConfig.setResponseHeaderEncoding("utf-8"); + endpointCluster.withHttpClientConfig(httpClientConfig); + + var sessionAffinityCookie = new YarpSessionAffinityCookieConfig(); + sessionAffinityCookie.setDomain("example.com"); + sessionAffinityCookie.setHttpOnly(true); + sessionAffinityCookie.setIsEssential(true); + sessionAffinityCookie.setPath("/"); + + var sessionAffinity = new YarpSessionAffinityConfig(); + sessionAffinity.setAffinityKeyName(".Aspire.Affinity"); + sessionAffinity.setEnabled(true); + sessionAffinity.setFailurePolicy("Redistribute"); + sessionAffinity.setPolicy("Cookie"); + sessionAffinity.setCookie(sessionAffinityCookie); + endpointCluster.withSessionAffinityConfig(sessionAffinity); + + var activeHealthCheck = new YarpActiveHealthCheckConfig(); + activeHealthCheck.setEnabled(true); + activeHealthCheck.setInterval(50_000_000.0); + activeHealthCheck.setPath("/health"); + activeHealthCheck.setPolicy("ConsecutiveFailures"); + activeHealthCheck.setQuery("probe=1"); + activeHealthCheck.setTimeout(20_000_000.0); + + var passiveHealthCheck = new YarpPassiveHealthCheckConfig(); + passiveHealthCheck.setEnabled(true); + passiveHealthCheck.setPolicy("TransportFailureRateHealthPolicy"); + passiveHealthCheck.setReactivationPeriod(100_000_000.0); + + var healthCheck = new YarpHealthCheckConfig(); + healthCheck.setAvailableDestinationsPolicy("HealthyOrPanic"); + healthCheck.setActive(activeHealthCheck); + healthCheck.setPassive(passiveHealthCheck); + endpointCluster.withHealthCheckConfig(healthCheck); + + var defaultRoute = config.addRoute("/{**catchall}", endpointCluster); + defaultRoute + .withTransformXForwarded() + .withTransformForwarded() + .withTransformClientCertHeader("X-Client-Cert") + .withTransformHttpMethodChange("GET", "POST") + .withTransformPathSet("/backend/{**catchall}") + .withTransformPathPrefix("/api") + .withTransformPathRemovePrefix("/legacy") + .withTransformPathRouteValues("/api/{id}") + .withTransformQueryValue("source", "apphost") + .withTransformQueryRouteValue("routeId", "id") + .withTransformQueryRemoveKey("remove") + .withTransformCopyRequestHeaders() + .withTransformUseOriginalHostHeader() + .withTransformRequestHeader("X-Test-Header", "test-value") + .withTransformRequestHeaderRouteValue("X-Route-Value", "id") + .withTransformRequestHeaderRemove("X-Remove-Request") + .withTransformRequestHeadersAllowed(new String[] { "X-Test-Header", "X-Route-Value" }) + .withTransformCopyResponseHeaders() + .withTransformCopyResponseTrailers() + .withTransformResponseHeader("X-Response-Header", "response-value") + .withTransformResponseHeaderRemove("X-Remove-Response") + .withTransformResponseHeadersAllowed(new String[] { "X-Response-Header" }) + .withTransformResponseTrailer("X-Response-Trailer", "trailer-value") + .withTransformResponseTrailerRemove("X-Remove-Trailer") + .withTransformResponseTrailersAllowed(new String[] { "X-Response-Trailer" }); + + var routeMatch = new YarpRouteMatch(); + routeMatch.setPath("/from-endpoint/{**catchall}"); + routeMatch.setMethods(new String[] { "GET", "POST" }); + routeMatch.setHosts(new String[] { "endpoint.example.com" }); + routeFromEndpoint.withMatch(routeMatch); + + routeFromEndpoint.withTransform(Map.ofEntries(Map.entry("PathPrefix", "/endpoint"), Map.entry("RequestHeadersCopy", "true"))); + routeFromResource.withTransform(Map.ofEntries(Map.entry("PathPrefix", "/resource"))); + routeFromExternalService.withTransform(Map.ofEntries(Map.entry("PathPrefix", "/external"))); + catchAllRoute.withTransform(Map.ofEntries(Map.entry("PathPrefix", "/cluster"))); + catchAllRouteFromEndpoint.withTransform(Map.ofEntries(Map.entry("PathPrefix", "/catchall-endpoint"))); + catchAllRouteFromResource.withTransform(Map.ofEntries(Map.entry("PathPrefix", "/catchall-resource"))); + catchAllRouteFromExternalService.withTransform(Map.ofEntries(Map.entry("PathPrefix", "/catchall-external"))); + config.addRoute("/resource/{**catchall}", resourceCluster); + config.addRoute("/external/{**catchall}", externalServiceCluster); + config.addRoute("/single/{**catchall}", singleDestinationCluster); + config.addRoute("/multi/{**catchall}", multiDestinationCluster); + }); + proxy.publishAsConnectionString(); + builder.build().run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting.Yarp/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting.Yarp/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..4d419a80c14 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting.Yarp/ValidationAppHost/aspire.config.json @@ -0,0 +1,21 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting.Yarp": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:29550;http://localhost:28731", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10775", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:13119" + } + } + } +} diff --git a/playground/polyglot/Java/Aspire.Hosting/ValidationAppHost/AppHost.java b/playground/polyglot/Java/Aspire.Hosting/ValidationAppHost/AppHost.java new file mode 100644 index 00000000000..74ce5489d22 --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting/ValidationAppHost/AppHost.java @@ -0,0 +1,100 @@ +import aspire.*; + +void main() throws Exception { + var builder = DistributedApplication.CreateBuilder(); + var container = builder.addContainer("mycontainer", "nginx"); + var dockerContainer = builder.addDockerfile("dockerapp", "./app"); + var exe = builder.addExecutable("myexe", "echo", ".", new String[] { "hello" }); + var project = builder.addProject("myproject", "./src/MyProject", "https"); + var csharpApp = builder.addCSharpApp("csharpapp", "./src/CSharpApp"); + var cache = builder.addRedis("cache"); + var tool = builder.addDotnetTool("mytool", "dotnet-ef"); + var configParam = builder.addParameterFromConfiguration("myconfig", "MyConfig:Key"); + var secretParam = builder.addParameterFromConfiguration("mysecret", "MyConfig:Secret", true); + container.withDockerfileBaseImage(new WithDockerfileBaseImageOptions().buildImage("mcr.microsoft.com/dotnet/sdk:8.0")); + container.withContainerRegistry(container); + dockerContainer.withHttpEndpoint(new WithHttpEndpointOptions().name("http").targetPort(80.0)); + var endpoint = dockerContainer.getEndpoint("http"); + var expr = ReferenceExpression.refExpr("Host=%s", endpoint); + var builtConnectionString = builder.addConnectionStringBuilder("customcs", (connectionStringBuilder) -> { var _isEmpty = connectionStringBuilder.isEmpty(); connectionStringBuilder.appendLiteral("Host="); connectionStringBuilder.appendValueProvider(endpoint); connectionStringBuilder.appendLiteral(";Key="); connectionStringBuilder.appendValueProvider(secretParam); var _builtExpression = connectionStringBuilder.build(); }); + builtConnectionString.withConnectionProperty("Host", expr); + builtConnectionString.withConnectionPropertyValue("Mode", "Development"); + container.withEnvironmentEndpoint("MY_ENDPOINT", endpoint); + container.withEnvironmentParameter("MY_PARAM", configParam); + container.withEnvironmentConnectionString("MY_CONN", builtConnectionString); + builtConnectionString.withConnectionProperty("Endpoint", expr); + builtConnectionString.withConnectionPropertyValue("Protocol", "https"); + container.excludeFromManifest(); + container.excludeFromMcp(); + container.waitForCompletion(exe); + container.withDeveloperCertificateTrust(true); + container.withCertificateTrustScope(CertificateTrustScope.SYSTEM); + container.withHttpsDeveloperCertificate(); + container.withoutHttpsCertificate(); + container.withChildRelationship(exe); + container.withIconName("Database", IconVariant.FILLED); + container.withHttpProbe(ProbeType.LIVENESS, new WithHttpProbeOptions().path("/health")); + container.withRemoteImageName("myregistry.azurecr.io/myapp"); + container.withRemoteImageTag("latest"); + container.withMcpServer(new WithMcpServerOptions().path("/mcp")); + container.withRequiredCommand("docker"); + tool.withToolIgnoreExistingFeeds(); + tool.withToolIgnoreFailedSources(); + tool.withToolPackage("dotnet-ef"); + tool.withToolPrerelease(); + tool.withToolSource("https://api.nuget.org/v3/index.json"); + tool.withToolVersion("8.0.0"); + tool.publishAsDockerFile(); + container.withPipelineStepFactory("custom-build-step", (stepContext) -> { var pipelineContext = stepContext.pipelineContext(); var pipelineModel = pipelineContext.model(); var _pipelineResources = pipelineModel.getResources(); var _pipelineContainer = pipelineModel.findResourceByName("mycontainer"); var pipelineServices = pipelineContext.services(); var pipelineLoggerFactory = pipelineServices.getLoggerFactory(); var pipelineFactoryLogger = pipelineLoggerFactory.createLogger("ValidationAppHost.PipelineContext"); pipelineFactoryLogger.logInformation("Pipeline factory context logger"); var pipelineLogger = pipelineContext.logger(); pipelineLogger.logDebug("Pipeline context logger"); var pipelineSummary = pipelineContext.summary(); pipelineSummary.add("PipelineContext", "Validated"); pipelineSummary.addMarkdown("PipelineMarkdown", "**Validated**"); var executionContext = stepContext.executionContext(); var _isPublishMode = executionContext.isPublishMode(); var stepServices = stepContext.services(); var stepLogger = stepContext.logger(); stepLogger.logInformation("Pipeline step context logger"); var stepSummary = stepContext.summary(); stepSummary.add("PipelineStepContext", "Validated"); var reportingStep = stepContext.reportingStep(); reportingStep.logStep("information", "Reporting step log"); reportingStep.logStepMarkdown("information", "**Reporting step markdown log**"); var reportingTask = reportingStep.createTask("Task created"); reportingTask.updateTask("Task updated"); reportingTask.updateTaskMarkdown("**Task markdown updated**"); reportingTask.completeTask(new CompleteTaskOptions().completionMessage("Task complete")); var markdownTask = reportingStep.createMarkdownTask("**Markdown task created**"); markdownTask.completeTaskMarkdown("**Markdown task complete**", new CompleteTaskMarkdownOptions().completionState("completed-with-warning")); reportingStep.completeStep("Reporting step complete"); reportingStep.completeStepMarkdown("**Reporting step markdown complete**", new CompleteStepMarkdownOptions().completionState("completed-with-warning")); var stepModel = stepContext.model(); var _stepResources = stepModel.getResources(); var _stepContainer = stepModel.findResourceByName("mycontainer"); var stepLoggerFactory = stepServices.getLoggerFactory(); var stepFactoryLogger = stepLoggerFactory.createLogger("ValidationAppHost.PipelineStepContext"); stepFactoryLogger.logDebug("Pipeline step factory logger"); var cancellationToken = stepContext.cancellationToken(); var cacheUriExpression = cache.uriExpression(); var _cacheUri = cacheUriExpression.getValue(cancellationToken); }, new WithPipelineStepFactoryOptions().dependsOn(new String[] { "build" }).requiredBy(new String[] { "deploy" }).tags(new String[] { "custom-build" }).description("Custom pipeline step")); + container.withPipelineConfiguration((configContext) -> { var configServices = configContext.services(); var configModel = configContext.model(); var _configResources = configModel.getResources(); var _configContainer = configModel.findResourceByName("mycontainer"); var configLoggerFactory = configServices.getLoggerFactory(); var configLogger = configLoggerFactory.createLogger("ValidationAppHost.PipelineConfigurationContext"); configLogger.logInformation("Pipeline configuration logger"); var allSteps = configContext.steps(); var taggedSteps = configContext.getStepsByTag("custom-build"); var _stepName = allSteps[0].name(); var _description = allSteps[0].description(); var _tags = allSteps[0].tags(); var _dependsOnSteps = allSteps[0].dependsOnSteps(); var _requiredBySteps = taggedSteps[0].requiredBySteps(); taggedSteps[0].requiredBy("publish"); allSteps[0].dependsOn("build"); }); + container.withPipelineConfigurationAsync((configContext) -> { var _configServices = configContext.services(); var _configModel = configContext.model(); var _resourceSteps = configContext.steps(); var _taggedSteps = configContext.getStepsByTag("custom-build"); }); + var _appHostDirectory = builder.appHostDirectory(); + var hostEnvironment = builder.environment(); + var _isDevelopment = hostEnvironment.isDevelopment(); + var _isProduction = hostEnvironment.isProduction(); + var _isStaging = hostEnvironment.isStaging(); + var _isSpecificEnvironment = hostEnvironment.isEnvironment("Development"); + var builderConfiguration = builder.getConfiguration(); + var _configValue = builderConfiguration.getConfigValue("MyConfig:Key"); + var _connectionString = builderConfiguration.getConnectionString("customcs"); + var _configSection = builderConfiguration.getSection("MyConfig"); + var _configChildren = builderConfiguration.getChildren(); + var _configExists = builderConfiguration.exists("MyConfig:Key"); + var builderExecutionContext = builder.executionContext(); + var executionContextServiceProvider = builderExecutionContext.serviceProvider(); + var _distributedApplicationModelFromExecutionContext = executionContextServiceProvider.getDistributedApplicationModel(); + var beforeStartSubscription = builder.subscribeBeforeStart((beforeStartEvent) -> { var beforeStartServices = beforeStartEvent.services(); var beforeStartModel = beforeStartEvent.model(); var _beforeStartResources = beforeStartModel.getResources(); var _beforeStartContainer = beforeStartModel.findResourceByName("mycontainer"); var _beforeStartEventing = beforeStartServices.getEventing(); var beforeStartLoggerFactory = beforeStartServices.getLoggerFactory(); var beforeStartLogger = beforeStartLoggerFactory.createLogger("ValidationAppHost.BeforeStart"); beforeStartLogger.logInformation("BeforeStart information"); beforeStartLogger.logWarning("BeforeStart warning"); beforeStartLogger.logError("BeforeStart error"); beforeStartLogger.logDebug("BeforeStart debug"); beforeStartLogger.log("critical", "BeforeStart critical"); var beforeStartResourceLoggerService = beforeStartServices.getResourceLoggerService(); beforeStartResourceLoggerService.completeLog(container); beforeStartResourceLoggerService.completeLogByName("mycontainer"); var beforeStartNotificationService = beforeStartServices.getResourceNotificationService(); beforeStartNotificationService.waitForResourceState("mycontainer", "Running"); var _matchedResourceState = beforeStartNotificationService.waitForResourceStates("mycontainer", new String[] { "Running", "FailedToStart" }); var _healthyResourceEvent = beforeStartNotificationService.waitForResourceHealthy("mycontainer"); beforeStartNotificationService.waitForDependencies(container); var _currentResourceState = beforeStartNotificationService.tryGetResourceState("mycontainer"); beforeStartNotificationService.publishResourceUpdate(container, new PublishResourceUpdateOptions().state("Validated").stateStyle("info")); var userSecretsManager = beforeStartServices.getUserSecretsManager(); var _userSecretsAvailable = userSecretsManager.isAvailable(); var _userSecretsFilePath = userSecretsManager.filePath(); var _secretSet = userSecretsManager.trySetSecret("Validation:Key", "value"); userSecretsManager.getOrSetSecret(container, "Validation:GeneratedKey", "generated-value"); var _generatedSecretValue = builderConfiguration.getConfigValue("Validation:GeneratedKey"); userSecretsManager.saveStateJson("{\"Validation\":\"Value\"}"); var _modelFromServices = beforeStartServices.getDistributedApplicationModel(); }); + var afterResourcesCreatedSubscription = builder.subscribeAfterResourcesCreated((afterResourcesCreatedEvent) -> { var afterResourcesCreatedServices = afterResourcesCreatedEvent.services(); var afterResourcesCreatedModel = afterResourcesCreatedEvent.model(); var _afterResources = afterResourcesCreatedModel.getResources(); var _afterResourcesContainer = afterResourcesCreatedModel.findResourceByName("mycontainer"); var afterResourcesCreatedLoggerFactory = afterResourcesCreatedServices.getLoggerFactory(); var afterResourcesCreatedLogger = afterResourcesCreatedLoggerFactory.createLogger("ValidationAppHost.AfterResourcesCreated"); afterResourcesCreatedLogger.logInformation("AfterResourcesCreated"); }); + var builderEventing = builder.eventing(); + builderEventing.unsubscribe(beforeStartSubscription); + builderEventing.unsubscribe(afterResourcesCreatedSubscription); + container.onBeforeResourceStarted((beforeResourceStartedEvent) -> { var _resource = beforeResourceStartedEvent.resource(); var services = beforeResourceStartedEvent.services(); var loggerFactory = services.getLoggerFactory(); var logger = loggerFactory.createLogger("ValidationAppHost.BeforeResourceStarted"); logger.logInformation("BeforeResourceStarted"); }); + container.onResourceStopped((resourceStoppedEvent) -> { var _resource = resourceStoppedEvent.resource(); var services = resourceStoppedEvent.services(); var loggerFactory = services.getLoggerFactory(); var logger = loggerFactory.createLogger("ValidationAppHost.ResourceStopped"); logger.logWarning("ResourceStopped"); }); + builtConnectionString.onConnectionStringAvailable((connectionStringAvailableEvent) -> { var _resource = connectionStringAvailableEvent.resource(); var services = connectionStringAvailableEvent.services(); var notifications = services.getResourceNotificationService(); var _connectionState = notifications.tryGetResourceState("customcs"); }); + container.onInitializeResource((initializeResourceEvent) -> { var _resource = initializeResourceEvent.resource(); var _initializeEventing = initializeResourceEvent.eventing(); var initializeLogger = initializeResourceEvent.logger(); var initializeNotifications = initializeResourceEvent.notifications(); var initializeServices = initializeResourceEvent.services(); initializeLogger.logDebug("InitializeResource"); initializeNotifications.waitForDependencies(container); var _initializeModel = initializeServices.getDistributedApplicationModel(); var _initializeEventingFromServices = initializeServices.getEventing(); }); + container.onResourceEndpointsAllocated((resourceEndpointsAllocatedEvent) -> { var _resource = resourceEndpointsAllocatedEvent.resource(); var services = resourceEndpointsAllocatedEvent.services(); var loggerFactory = services.getLoggerFactory(); var logger = loggerFactory.createLogger("ValidationAppHost.ResourceEndpointsAllocated"); logger.logInformation("ResourceEndpointsAllocated"); }); + container.onResourceReady((resourceReadyEvent) -> { var _resource = resourceReadyEvent.resource(); var services = resourceReadyEvent.services(); var loggerFactory = services.getLoggerFactory(); var logger = loggerFactory.createLogger("ValidationAppHost.ResourceReady"); logger.logInformation("ResourceReady"); }); + container.withEnvironment("MY_VAR", "value"); + container.withEndpoint(); + container.withHttpEndpoint(); + container.withHttpsEndpoint(); + container.withExternalHttpEndpoints(); + container.asHttp2Service(); + container.withArgs(new String[] { "--verbose" }); + container.withParentRelationship(exe); + container.withExplicitStart(); + container.withUrl("http://localhost:8080"); + container.withUrlExpression(ReferenceExpression.refExpr("http://%s", endpoint)); + container.withHealthCheck("mycheck"); + container.withHttpHealthCheck(); + container.withCommand("restart", "Restart", (_ctx) -> { + var result = new ExecuteCommandResult(); + result.setSuccess(true); + return result; + }); + var app = builder.build(); + var _distributedAppConnectionString = app.getConnectionString("customcs"); + var _distributedAppEndpoint = app.getEndpoint("dockerapp", "http"); + var _distributedAppEndpointForNetwork = app.getEndpointForNetwork("dockerapp", new GetEndpointForNetworkOptions().networkIdentifier("localhost").endpointName("http")); + app.run(); + } diff --git a/playground/polyglot/Java/Aspire.Hosting/ValidationAppHost/aspire.config.json b/playground/polyglot/Java/Aspire.Hosting/ValidationAppHost/aspire.config.json new file mode 100644 index 00000000000..b4a5675903a --- /dev/null +++ b/playground/polyglot/Java/Aspire.Hosting/ValidationAppHost/aspire.config.json @@ -0,0 +1,24 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "features": { + "experimentalPolyglot:java": true + }, + "packages": { + "Aspire.Hosting": "", + "Aspire.Hosting.Testing": "", + "Aspire.Hosting.Yarp": "", + "Aspire.Hosting.Redis": "" + }, + "profiles": { + "https": { + "applicationUrl": "https://localhost:29750;http://localhost:28931", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://localhost:10975", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://localhost:13319" + } + } + } +} diff --git a/src/Aspire.Cli/Resources/TemplatingStrings.Designer.cs b/src/Aspire.Cli/Resources/TemplatingStrings.Designer.cs index a5712adf0fd..cf820142ea9 100644 --- a/src/Aspire.Cli/Resources/TemplatingStrings.Designer.cs +++ b/src/Aspire.Cli/Resources/TemplatingStrings.Designer.cs @@ -150,6 +150,15 @@ public static string AspireJsFrontendStarter_Description { } } + /// + /// Looks up a localized string similar to Java AppHost, Express, and React starter. + /// + public static string AspireJavaStarter_Description { + get { + return ResourceManager.GetString("AspireJavaStarter_Description", resourceCulture); + } + } + /// /// Looks up a localized string similar to xUnit. /// diff --git a/src/Aspire.Cli/Resources/TemplatingStrings.resx b/src/Aspire.Cli/Resources/TemplatingStrings.resx index 9e9488cfa20..4a94f2183b0 100644 --- a/src/Aspire.Cli/Resources/TemplatingStrings.resx +++ b/src/Aspire.Cli/Resources/TemplatingStrings.resx @@ -126,6 +126,9 @@ Starter App (ASP.NET Core/React) + + Starter App (Java AppHost/Express/React) + AppHost and service defaults diff --git a/src/Aspire.Cli/Resources/xlf/TemplatingStrings.cs.xlf b/src/Aspire.Cli/Resources/xlf/TemplatingStrings.cs.xlf index 10e15cf71ed..25bed11cc31 100644 --- a/src/Aspire.Cli/Resources/xlf/TemplatingStrings.cs.xlf +++ b/src/Aspire.Cli/Resources/xlf/TemplatingStrings.cs.xlf @@ -17,6 +17,11 @@ AppHost a výchozí nastavení služby + + Starter App (Java AppHost/Express/React) + Starter App (Java AppHost/Express/React) + + Starter App (ASP.NET Core/React) Úvodní aplikace (ASP.NET Core/React) diff --git a/src/Aspire.Cli/Resources/xlf/TemplatingStrings.de.xlf b/src/Aspire.Cli/Resources/xlf/TemplatingStrings.de.xlf index d63be5b0c43..5fd2b4766de 100644 --- a/src/Aspire.Cli/Resources/xlf/TemplatingStrings.de.xlf +++ b/src/Aspire.Cli/Resources/xlf/TemplatingStrings.de.xlf @@ -17,6 +17,11 @@ AppHost und Dienststandardwerte + + Starter App (Java AppHost/Express/React) + Starter App (Java AppHost/Express/React) + + Starter App (ASP.NET Core/React) Starter-App (ASP.NET Core/React) diff --git a/src/Aspire.Cli/Resources/xlf/TemplatingStrings.es.xlf b/src/Aspire.Cli/Resources/xlf/TemplatingStrings.es.xlf index 03995c63882..b623ce45f3a 100644 --- a/src/Aspire.Cli/Resources/xlf/TemplatingStrings.es.xlf +++ b/src/Aspire.Cli/Resources/xlf/TemplatingStrings.es.xlf @@ -17,6 +17,11 @@ AppHost y servicios predeterminados + + Starter App (Java AppHost/Express/React) + Starter App (Java AppHost/Express/React) + + Starter App (ASP.NET Core/React) Aplicación de inicio (ASP.NET Core/React) diff --git a/src/Aspire.Cli/Resources/xlf/TemplatingStrings.fr.xlf b/src/Aspire.Cli/Resources/xlf/TemplatingStrings.fr.xlf index 12eeb3cf685..a11448a6953 100644 --- a/src/Aspire.Cli/Resources/xlf/TemplatingStrings.fr.xlf +++ b/src/Aspire.Cli/Resources/xlf/TemplatingStrings.fr.xlf @@ -17,6 +17,11 @@ AppHost et les paramètres par défaut du service + + Starter App (Java AppHost/Express/React) + Starter App (Java AppHost/Express/React) + + Starter App (ASP.NET Core/React) Application de démarrage (ASP.NET Core/React) diff --git a/src/Aspire.Cli/Resources/xlf/TemplatingStrings.it.xlf b/src/Aspire.Cli/Resources/xlf/TemplatingStrings.it.xlf index f7141f0ec30..b7ae26657b3 100644 --- a/src/Aspire.Cli/Resources/xlf/TemplatingStrings.it.xlf +++ b/src/Aspire.Cli/Resources/xlf/TemplatingStrings.it.xlf @@ -17,6 +17,11 @@ Impostazioni predefinite di AppHost e del servizio + + Starter App (Java AppHost/Express/React) + Starter App (Java AppHost/Express/React) + + Starter App (ASP.NET Core/React) Starter App (ASP.NET Core/React) diff --git a/src/Aspire.Cli/Resources/xlf/TemplatingStrings.ja.xlf b/src/Aspire.Cli/Resources/xlf/TemplatingStrings.ja.xlf index 1d91797d579..c664e10c1fa 100644 --- a/src/Aspire.Cli/Resources/xlf/TemplatingStrings.ja.xlf +++ b/src/Aspire.Cli/Resources/xlf/TemplatingStrings.ja.xlf @@ -17,6 +17,11 @@ AppHost およびサービスの既定値 + + Starter App (Java AppHost/Express/React) + Starter App (Java AppHost/Express/React) + + Starter App (ASP.NET Core/React) スターター アプリ (ASP.NET Core/React) diff --git a/src/Aspire.Cli/Resources/xlf/TemplatingStrings.ko.xlf b/src/Aspire.Cli/Resources/xlf/TemplatingStrings.ko.xlf index a79ace77751..a07a0837d8d 100644 --- a/src/Aspire.Cli/Resources/xlf/TemplatingStrings.ko.xlf +++ b/src/Aspire.Cli/Resources/xlf/TemplatingStrings.ko.xlf @@ -17,6 +17,11 @@ AppHost 및 서비스 기본값 + + Starter App (Java AppHost/Express/React) + Starter App (Java AppHost/Express/React) + + Starter App (ASP.NET Core/React) 시작 앱(ASP.NET Core/React) diff --git a/src/Aspire.Cli/Resources/xlf/TemplatingStrings.pl.xlf b/src/Aspire.Cli/Resources/xlf/TemplatingStrings.pl.xlf index d3645708ce9..63c1a26c50a 100644 --- a/src/Aspire.Cli/Resources/xlf/TemplatingStrings.pl.xlf +++ b/src/Aspire.Cli/Resources/xlf/TemplatingStrings.pl.xlf @@ -17,6 +17,11 @@ AppHost i ustawienia domyślne usługi + + Starter App (Java AppHost/Express/React) + Starter App (Java AppHost/Express/React) + + Starter App (ASP.NET Core/React) Aplikacja startowa (ASP.NET Core/React) diff --git a/src/Aspire.Cli/Resources/xlf/TemplatingStrings.pt-BR.xlf b/src/Aspire.Cli/Resources/xlf/TemplatingStrings.pt-BR.xlf index 8b6ad9efe2e..6e95d101a5d 100644 --- a/src/Aspire.Cli/Resources/xlf/TemplatingStrings.pt-BR.xlf +++ b/src/Aspire.Cli/Resources/xlf/TemplatingStrings.pt-BR.xlf @@ -17,6 +17,11 @@ AppHost e padrões de serviço + + Starter App (Java AppHost/Express/React) + Starter App (Java AppHost/Express/React) + + Starter App (ASP.NET Core/React) Aplicativo inicial (ASP.NET Core/React) diff --git a/src/Aspire.Cli/Resources/xlf/TemplatingStrings.ru.xlf b/src/Aspire.Cli/Resources/xlf/TemplatingStrings.ru.xlf index f7263021c9f..e79e3e4e656 100644 --- a/src/Aspire.Cli/Resources/xlf/TemplatingStrings.ru.xlf +++ b/src/Aspire.Cli/Resources/xlf/TemplatingStrings.ru.xlf @@ -17,6 +17,11 @@ AppHost и службы по умолчанию + + Starter App (Java AppHost/Express/React) + Starter App (Java AppHost/Express/React) + + Starter App (ASP.NET Core/React) Начальное приложение (ASP.NET Core/React) diff --git a/src/Aspire.Cli/Resources/xlf/TemplatingStrings.tr.xlf b/src/Aspire.Cli/Resources/xlf/TemplatingStrings.tr.xlf index 2706d8e6108..c128af9d906 100644 --- a/src/Aspire.Cli/Resources/xlf/TemplatingStrings.tr.xlf +++ b/src/Aspire.Cli/Resources/xlf/TemplatingStrings.tr.xlf @@ -17,6 +17,11 @@ AppHost ve hizmet varsayılanları + + Starter App (Java AppHost/Express/React) + Starter App (Java AppHost/Express/React) + + Starter App (ASP.NET Core/React) Başlangıç Uygulaması (ASP.NET Core/React) diff --git a/src/Aspire.Cli/Resources/xlf/TemplatingStrings.zh-Hans.xlf b/src/Aspire.Cli/Resources/xlf/TemplatingStrings.zh-Hans.xlf index 0230e119447..aedebc47ba6 100644 --- a/src/Aspire.Cli/Resources/xlf/TemplatingStrings.zh-Hans.xlf +++ b/src/Aspire.Cli/Resources/xlf/TemplatingStrings.zh-Hans.xlf @@ -17,6 +17,11 @@ AppHost 和服务默认值 + + Starter App (Java AppHost/Express/React) + Starter App (Java AppHost/Express/React) + + Starter App (ASP.NET Core/React) 入门应用(ASP.NET Core/React) diff --git a/src/Aspire.Cli/Resources/xlf/TemplatingStrings.zh-Hant.xlf b/src/Aspire.Cli/Resources/xlf/TemplatingStrings.zh-Hant.xlf index e5a37e45e00..82a9a3c4365 100644 --- a/src/Aspire.Cli/Resources/xlf/TemplatingStrings.zh-Hant.xlf +++ b/src/Aspire.Cli/Resources/xlf/TemplatingStrings.zh-Hant.xlf @@ -17,6 +17,11 @@ AppHost 和服務預設值 + + Starter App (Java AppHost/Express/React) + Starter App (Java AppHost/Express/React) + + Starter App (ASP.NET Core/React) 入門應用程式 (ASP.NET Core/React) diff --git a/src/Aspire.Cli/Templating/CliTemplateFactory.cs b/src/Aspire.Cli/Templating/CliTemplateFactory.cs index 41618049ce2..3ef1826fa2a 100644 --- a/src/Aspire.Cli/Templating/CliTemplateFactory.cs +++ b/src/Aspire.Cli/Templating/CliTemplateFactory.cs @@ -81,12 +81,12 @@ public Task> GetTemplatesAsync(CancellationToken cancella public Task> GetInitTemplatesAsync(CancellationToken cancellationToken = default) { - return Task.FromResult>([]); + return Task.FromResult>(Array.Empty()); } private IEnumerable GetTemplateDefinitions() { - return + ITemplate[] templates = [ new CallbackTemplate( KnownTemplateId.TypeScriptStarter, @@ -115,8 +115,30 @@ private IEnumerable GetTemplateDefinitions() ApplyEmptyAppHostTemplateAsync, runtime: TemplateRuntime.Cli, languageId: KnownLanguageId.TypeScript, + isEmpty: true), + + new CallbackTemplate( + KnownTemplateId.JavaEmptyAppHost, + "Empty (Java AppHost)", + projectName => $"./{projectName}", + cmd => AddOptionIfMissing(cmd, _localhostTldOption), + ApplyEmptyAppHostTemplateAsync, + runtime: TemplateRuntime.Cli, + languageId: KnownLanguageId.Java, isEmpty: true) ]; + + return templates.Where(IsTemplateAvailable); + } + + private bool IsTemplateAvailable(ITemplate template) + { + if (string.IsNullOrWhiteSpace(template.LanguageId)) + { + return true; + } + + return _languageDiscovery.GetLanguageById(new LanguageId(template.LanguageId)) is not null; } private static string ApplyTokens(string content, string projectName, string projectNameLower, string aspireVersion, TemplatePorts ports, string hostName = "localhost") diff --git a/src/Aspire.Cli/Templating/KnownTemplateId.cs b/src/Aspire.Cli/Templating/KnownTemplateId.cs index 59d90eeb078..36216035a26 100644 --- a/src/Aspire.Cli/Templating/KnownTemplateId.cs +++ b/src/Aspire.Cli/Templating/KnownTemplateId.cs @@ -27,4 +27,9 @@ internal static class KnownTemplateId /// The template ID for the TypeScript starter template. /// public const string TypeScriptStarter = "aspire-ts-starter"; + + /// + /// The template ID for the CLI Java empty AppHost template. + /// + public const string JavaEmptyAppHost = "aspire-java-empty"; } diff --git a/src/Aspire.Cli/Templating/Templates/java-starter/AppHost.java b/src/Aspire.Cli/Templating/Templates/java-starter/AppHost.java new file mode 100644 index 00000000000..31bbe44c623 --- /dev/null +++ b/src/Aspire.Cli/Templating/Templates/java-starter/AppHost.java @@ -0,0 +1,19 @@ +package aspire; + +final class AppHost { + void main() throws Exception { + IDistributedApplicationBuilder builder = DistributedApplication.CreateBuilder(); + + NodeAppResource app = builder.addNodeApp("app", "./api", "src/index.ts"); + app.withHttpEndpoint(new WithHttpEndpointOptions().env("PORT")); + app.withExternalHttpEndpoints(); + + ViteAppResource frontend = builder.addViteApp("frontend", "./frontend"); + frontend.withReference(app); + frontend.waitFor(app); + + app.publishWithContainerFiles(frontend, "./static"); + + builder.build().run(); + } +} diff --git a/src/Aspire.Cli/Templating/Templates/java-starter/api/package.json b/src/Aspire.Cli/Templating/Templates/java-starter/api/package.json new file mode 100644 index 00000000000..296e3af621c --- /dev/null +++ b/src/Aspire.Cli/Templating/Templates/java-starter/api/package.json @@ -0,0 +1,22 @@ +{ + "name": "{{projectNameLower}}-api", + "private": true, + "type": "module", + "scripts": { + "start": "tsx src/index.ts" + }, + "dependencies": { + "@opentelemetry/auto-instrumentations-node": "^0.71.0", + "@opentelemetry/exporter-logs-otlp-grpc": "^0.213.0", + "@opentelemetry/exporter-metrics-otlp-grpc": "^0.213.0", + "@opentelemetry/exporter-trace-otlp-grpc": "^0.213.0", + "@opentelemetry/sdk-logs": "^0.213.0", + "@opentelemetry/sdk-metrics": "^2.6.0", + "@opentelemetry/sdk-node": "^0.213.0", + "express": "^5.1.0" + }, + "devDependencies": { + "@types/express": "^5.0.6", + "tsx": "^4.21.0" + } +} diff --git a/src/Aspire.Cli/Templating/Templates/java-starter/api/src/index.ts b/src/Aspire.Cli/Templating/Templates/java-starter/api/src/index.ts new file mode 100644 index 00000000000..4d2c25855e1 --- /dev/null +++ b/src/Aspire.Cli/Templating/Templates/java-starter/api/src/index.ts @@ -0,0 +1,42 @@ +/** + * Import the OpenTelemetry instrumentation setup first, before any other modules. + * This ensures all subsequent imports are automatically instrumented for + * distributed tracing, metrics, and logging in the Aspire dashboard. + */ +import "./instrumentation.ts"; +import express from "express"; +import { existsSync } from "fs"; +import { join } from "path"; + +const app = express(); +const port = process.env.PORT || 5000; + +/** Returns a random 5-day weather forecast as JSON. */ +app.get("/api/weatherforecast", (_req, res) => { + const summaries = ["Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"]; + const forecasts = Array.from({ length: 5 }, (_, i) => { + const temperatureC = Math.floor(Math.random() * 75) - 20; + return { + date: new Date(Date.now() + (i + 1) * 86400000).toISOString(), + temperatureC, + temperatureF: 32 + Math.trunc(temperatureC / 0.5556), + summary: summaries[Math.floor(Math.random() * summaries.length)], + }; + }); + res.json(forecasts); +}); + +app.get("/health", (_req, res) => { + res.send("Healthy"); +}); + +// Serve static files from the "static" directory if it exists (used in publish/deploy mode +// when the frontend's build output is bundled into this container via publishWithContainerFiles) +const staticDir = join(import.meta.dirname, "..", "static"); +if (existsSync(staticDir)) { + app.use(express.static(staticDir)); +} + +app.listen(port, () => { + console.log(`API server listening on port ${port}`); +}); diff --git a/src/Aspire.Cli/Templating/Templates/java-starter/api/src/instrumentation.ts b/src/Aspire.Cli/Templating/Templates/java-starter/api/src/instrumentation.ts new file mode 100644 index 00000000000..c19e073d172 --- /dev/null +++ b/src/Aspire.Cli/Templating/Templates/java-starter/api/src/instrumentation.ts @@ -0,0 +1,42 @@ +/** + * OpenTelemetry instrumentation for the app. + * + * When the OTEL_EXPORTER_OTLP_ENDPOINT environment variable is set (automatically + * configured by Aspire), this module initializes the OpenTelemetry Node.js SDK to + * collect and export distributed traces, metrics, and logs to the Aspire dashboard. + * + * This file must be imported before any other modules to ensure all libraries + * are automatically instrumented. + * + * @see https://opentelemetry.io/docs/languages/js/getting-started/nodejs/ + */ +import { env } from 'node:process'; +import { NodeSDK } from '@opentelemetry/sdk-node'; +import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node'; +import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-grpc'; +import { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-grpc'; +import { OTLPLogExporter } from '@opentelemetry/exporter-logs-otlp-grpc'; +import { BatchLogRecordProcessor } from '@opentelemetry/sdk-logs'; +import { PeriodicExportingMetricReader } from '@opentelemetry/sdk-metrics'; + +if (env.OTEL_EXPORTER_OTLP_ENDPOINT) { + const sdk = new NodeSDK({ + traceExporter: new OTLPTraceExporter(), + metricReader: new PeriodicExportingMetricReader({ + exporter: new OTLPMetricExporter(), + }), + logRecordProcessor: new BatchLogRecordProcessor( + new OTLPLogExporter(), + ), + instrumentations: [getNodeAutoInstrumentations()], + }); + + sdk.start(); + + process.on('SIGTERM', () => { + sdk.shutdown().finally(() => process.exit(0)); + }); + process.on('SIGINT', () => { + sdk.shutdown().finally(() => process.exit(0)); + }); +} diff --git a/src/Aspire.Cli/Templating/Templates/java-starter/api/tsconfig.json b/src/Aspire.Cli/Templating/Templates/java-starter/api/tsconfig.json new file mode 100644 index 00000000000..6f1f8cb7405 --- /dev/null +++ b/src/Aspire.Cli/Templating/Templates/java-starter/api/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "outDir": "./dist" + }, + "include": ["src"] +} diff --git a/src/Aspire.Cli/Templating/Templates/java-starter/aspire.config.json b/src/Aspire.Cli/Templating/Templates/java-starter/aspire.config.json new file mode 100644 index 00000000000..ec9a8f30d23 --- /dev/null +++ b/src/Aspire.Cli/Templating/Templates/java-starter/aspire.config.json @@ -0,0 +1,26 @@ +{ + "appHost": { + "path": "AppHost.java", + "language": "java" + }, + "packages": { + "Aspire.Hosting.JavaScript": "{{aspireVersion}}" + }, + "profiles": { + "https": { + "applicationUrl": "https://{{hostName}}:{{httpsPort}};http://{{hostName}}:{{httpPort}}", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "https://{{hostName}}:{{otlpHttpsPort}}", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "https://{{hostName}}:{{resourceHttpsPort}}" + } + }, + "http": { + "applicationUrl": "http://{{hostName}}:{{httpPort}}", + "environmentVariables": { + "ASPIRE_DASHBOARD_OTLP_ENDPOINT_URL": "http://{{hostName}}:{{otlpHttpPort}}", + "ASPIRE_RESOURCE_SERVICE_ENDPOINT_URL": "http://{{hostName}}:{{resourceHttpPort}}", + "ASPIRE_ALLOW_UNSECURED_TRANSPORT": "true" + } + } + } +} diff --git a/src/Aspire.Cli/Templating/Templates/java-starter/frontend/.dockerignore b/src/Aspire.Cli/Templating/Templates/java-starter/frontend/.dockerignore new file mode 100644 index 00000000000..b9470778764 --- /dev/null +++ b/src/Aspire.Cli/Templating/Templates/java-starter/frontend/.dockerignore @@ -0,0 +1,2 @@ +node_modules/ +dist/ diff --git a/src/Aspire.Cli/Templating/Templates/java-starter/frontend/.gitignore b/src/Aspire.Cli/Templating/Templates/java-starter/frontend/.gitignore new file mode 100644 index 00000000000..a547bf36d8d --- /dev/null +++ b/src/Aspire.Cli/Templating/Templates/java-starter/frontend/.gitignore @@ -0,0 +1,24 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? diff --git a/src/Aspire.Cli/Templating/Templates/java-starter/frontend/eslint.config.js b/src/Aspire.Cli/Templating/Templates/java-starter/frontend/eslint.config.js new file mode 100644 index 00000000000..2b3e6ccfb16 --- /dev/null +++ b/src/Aspire.Cli/Templating/Templates/java-starter/frontend/eslint.config.js @@ -0,0 +1,28 @@ +import js from '@eslint/js'; +import globals from 'globals'; +import reactHooks from 'eslint-plugin-react-hooks'; +import reactRefresh from 'eslint-plugin-react-refresh'; +import tseslint from 'typescript-eslint'; + +export default tseslint.config( + { ignores: ['dist'] }, + { + extends: [js.configs.recommended, ...tseslint.configs.recommended], + files: ['**/*.{ts,tsx}'], + languageOptions: { + ecmaVersion: 2020, + globals: globals.browser, + }, + plugins: { + 'react-hooks': reactHooks, + 'react-refresh': reactRefresh, + }, + rules: { + ...reactHooks.configs.recommended.rules, + 'react-refresh/only-export-components': [ + 'warn', + { allowConstantExport: true }, + ], + }, + }, +); diff --git a/src/Aspire.Cli/Templating/Templates/java-starter/frontend/index.html b/src/Aspire.Cli/Templating/Templates/java-starter/frontend/index.html new file mode 100644 index 00000000000..472646d2e0f --- /dev/null +++ b/src/Aspire.Cli/Templating/Templates/java-starter/frontend/index.html @@ -0,0 +1,13 @@ + + + + + + + Aspire Starter + + +
+ + + diff --git a/src/Aspire.Cli/Templating/Templates/java-starter/frontend/package-lock.json b/src/Aspire.Cli/Templating/Templates/java-starter/frontend/package-lock.json new file mode 100644 index 00000000000..cf8c8acaba1 --- /dev/null +++ b/src/Aspire.Cli/Templating/Templates/java-starter/frontend/package-lock.json @@ -0,0 +1,2430 @@ +{ + "name": "frontend", + "version": "0.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "frontend", + "version": "0.0.0", + "dependencies": { + "react": "^19.2.1", + "react-dom": "^19.2.1" + }, + "devDependencies": { + "@eslint/js": "^9.39.1", + "@types/node": "^24.10.1", + "@types/react": "^19.2.7", + "@types/react-dom": "^19.2.3", + "@vitejs/plugin-react": "^6.0.0", + "eslint": "^9.39.1", + "eslint-plugin-react-hooks": "^5.2.0", + "eslint-plugin-react-refresh": "^0.4.24", + "globals": "^16.5.0", + "typescript": "~5.9.3", + "typescript-eslint": "^8.48.1", + "vite": "^8.0.0" + } + }, + "node_modules/@emnapi/core": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.9.0.tgz", + "integrity": "sha512-0DQ98G9ZQZOxfUcQn1waV2yS8aWdZ6kJMbYCJB3oUBecjWYO1fqJ+a1DRfPF3O5JEkwqwP1A9QEN/9mYm2Yd0w==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/wasi-threads": "1.2.0", + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/runtime": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.9.0.tgz", + "integrity": "sha512-QN75eB0IH2ywSpRpNddCRfQIhmJYBCJ1x5Lb3IscKAL8bMnVAKnRg8dCoXbHzVLLH7P38N2Z3mtulB7W0J0FKw==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@emnapi/wasi-threads": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.0.tgz", + "integrity": "sha512-N10dEJNSsUx41Z6pZsXU8FjPjpBEplgH24sfkmITrBED1/U2Esum9F3lfLrMjKHHjmi557zQn7kR9R+XWXu5Rg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.9.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.0.tgz", + "integrity": "sha512-ayVFHdtZ+hsq1t2Dy24wCmGXGe4q9Gu3smhLYALJrr473ZH27MsnSL+LKUlimp4BWJqMDMLmPpx/Q9R3OAlL4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.12.2", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz", + "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, + "node_modules/@eslint/config-array": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.1.tgz", + "integrity": "sha512-aw1gNayWpdI/jSYVgzN5pL0cfzU02GT3NBpeT/DXbx1/1x7ZKxFPd9bwrzygx/qiwIQiJ1sw/zD8qY/kRvlGHA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/object-schema": "^2.1.7", + "debug": "^4.3.1", + "minimatch": "^3.1.2" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/config-helpers": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.4.2.tgz", + "integrity": "sha512-gBrxN88gOIf3R7ja5K9slwNayVcZgK6SOUORm2uBzTeIEfeVaIhOpCtTox3P6R7o2jLFwLFTLnC7kU/RGcYEgw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^0.17.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/core": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.17.0.tgz", + "integrity": "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@types/json-schema": "^7.0.15" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/eslintrc": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.3.tgz", + "integrity": "sha512-Kr+LPIUVKz2qkx1HAMH8q1q6azbqBAsXJUxBl/ODDuVPX45Z9DfwB8tPjTi6nNZ8BuM3nbJxC5zCAg5elnBUTQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^10.0.1", + "globals": "^14.0.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.1", + "minimatch": "^3.1.2", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz", + "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/js": { + "version": "9.39.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.1.tgz", + "integrity": "sha512-S26Stp4zCy88tH94QbBv3XCuzRQiZ9yXofEILmglYTh/Ug/a9/umqvgFtYBAo3Lp0nsI/5/qH1CCrbdK3AP1Tw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" + } + }, + "node_modules/@eslint/object-schema": { + "version": "2.1.7", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.7.tgz", + "integrity": "sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@eslint/plugin-kit": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.4.1.tgz", + "integrity": "sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@eslint/core": "^0.17.0", + "levn": "^0.4.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + } + }, + "node_modules/@humanfs/core": { + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.1.tgz", + "integrity": "sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanfs/node": { + "version": "0.16.7", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.7.tgz", + "integrity": "sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@humanfs/core": "^0.19.1", + "@humanwhocodes/retry": "^0.4.0" + }, + "engines": { + "node": ">=18.18.0" + } + }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@humanwhocodes/retry": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz", + "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18.18" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, + "node_modules/@napi-rs/wasm-runtime": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.1.tgz", + "integrity": "sha512-p64ah1M1ld8xjWv3qbvFwHiFVWrq1yFvV4f7w+mzaqiR4IlSgkqhcRdHwsGgomwzBH51sRY4NEowLxnaBjcW/A==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@emnapi/core": "^1.7.1", + "@emnapi/runtime": "^1.7.1", + "@tybys/wasm-util": "^0.10.1" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + } + }, + "node_modules/@oxc-project/runtime": { + "version": "0.115.0", + "resolved": "https://registry.npmjs.org/@oxc-project/runtime/-/runtime-0.115.0.tgz", + "integrity": "sha512-Rg8Wlt5dCbXhQnsXPrkOjL1DTSvXLgb2R/KYfnf1/K+R0k6UMLEmbQXPM+kwrWqSmWA2t0B1EtHy2/3zikQpvQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxc-project/types": { + "version": "0.115.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.115.0.tgz", + "integrity": "sha512-4n91DKnebUS4yjUHl2g3/b2T+IUdCfmoZGhmwsovZCDaJSs+QkVAM+0AqqTxHSsHfeiMuueT75cZaZcT/m0pSw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/Boshen" + } + }, + "node_modules/@rolldown/binding-android-arm64": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.0.0-rc.9.tgz", + "integrity": "sha512-lcJL0bN5hpgJfSIz/8PIf02irmyL43P+j1pTCfbD1DbLkmGRuFIA4DD3B3ZOvGqG0XiVvRznbKtN0COQVaKUTg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-arm64": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.0.0-rc.9.tgz", + "integrity": "sha512-J7Zk3kLYFsLtuH6U+F4pS2sYVzac0qkjcO5QxHS7OS7yZu2LRs+IXo+uvJ/mvpyUljDJ3LROZPoQfgBIpCMhdQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-darwin-x64": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.0.0-rc.9.tgz", + "integrity": "sha512-iwtmmghy8nhfRGeNAIltcNXzD0QMNaaA5U/NyZc1Ia4bxrzFByNMDoppoC+hl7cDiUq5/1CnFthpT9n+UtfFyg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-freebsd-x64": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.0.0-rc.9.tgz", + "integrity": "sha512-DLFYI78SCiZr5VvdEplsVC2Vx53lnA4/Ga5C65iyldMVaErr86aiqCoNBLl92PXPfDtUYjUh+xFFor40ueNs4Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm-gnueabihf": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.0.0-rc.9.tgz", + "integrity": "sha512-CsjTmTwd0Hri6iTw/DRMK7kOZ7FwAkrO4h8YWKoX/kcj833e4coqo2wzIFywtch/8Eb5enQ/lwLM7w6JX1W5RQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-gnu": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.0.0-rc.9.tgz", + "integrity": "sha512-2x9O2JbSPxpxMDhP9Z74mahAStibTlrBMW0520+epJH5sac7/LwZW5Bmg/E6CXuEF53JJFW509uP+lSedaUNxg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-arm64-musl": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.0.0-rc.9.tgz", + "integrity": "sha512-JA1QRW31ogheAIRhIg9tjMfsYbglXXYGNPLdPEYrwFxdbkQCAzvpSCSHCDWNl4hTtrol8WeboCSEpjdZK8qrCg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-ppc64-gnu": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.0.0-rc.9.tgz", + "integrity": "sha512-aOKU9dJheda8Kj8Y3w9gnt9QFOO+qKPAl8SWd7JPHP+Cu0EuDAE5wokQubLzIDQWg2myXq2XhTpOVS07qqvT+w==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-s390x-gnu": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.0.0-rc.9.tgz", + "integrity": "sha512-OalO94fqj7IWRn3VdXWty75jC5dk4C197AWEuMhIpvVv2lw9fiPhud0+bW2ctCxb3YoBZor71QHbY+9/WToadA==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-gnu": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.0.0-rc.9.tgz", + "integrity": "sha512-cVEl1vZtBsBZna3YMjGXNvnYYrOJ7RzuWvZU0ffvJUexWkukMaDuGhUXn0rjnV0ptzGVkvc+vW9Yqy6h8YX4pg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-linux-x64-musl": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.0.0-rc.9.tgz", + "integrity": "sha512-UzYnKCIIc4heAKgI4PZ3dfBGUZefGCJ1TPDuLHoCzgrMYPb5Rv6TLFuYtyM4rWyHM7hymNdsg5ik2C+UD9VDbA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-openharmony-arm64": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.0.0-rc.9.tgz", + "integrity": "sha512-+6zoiF+RRyf5cdlFQP7nm58mq7+/2PFaY2DNQeD4B87N36JzfF/l9mdBkkmTvSYcYPE8tMh/o3cRlsx1ldLfog==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-wasm32-wasi": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-wasm32-wasi/-/binding-wasm32-wasi-1.0.0-rc.9.tgz", + "integrity": "sha512-rgFN6sA/dyebil3YTlL2evvi/M+ivhfnyxec7AccTpRPccno/rPoNlqybEZQBkcbZu8Hy+eqNJCqfBR8P7Pg8g==", + "cpu": [ + "wasm32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "@napi-rs/wasm-runtime": "^1.1.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@rolldown/binding-win32-arm64-msvc": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.0.0-rc.9.tgz", + "integrity": "sha512-lHVNUG/8nlF1IQk1C0Ci574qKYyty2goMiPlRqkC5R+3LkXDkL5Dhx8ytbxq35m+pkHVIvIxviD+TWLdfeuadA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/binding-win32-x64-msvc": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.0.0-rc.9.tgz", + "integrity": "sha512-G0oA4+w1iY5AGi5HcDTxWsoxF509hrFIPB2rduV5aDqS9FtDg1CAfa7V34qImbjfhIcA8C+RekocJZA96EarwQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.0.0-rc.7", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-rc.7.tgz", + "integrity": "sha512-qujRfC8sFVInYSPPMLQByRh7zhwkGFS4+tyMQ83srV1qrxL4g8E2tyxVVyxd0+8QeBM1mIk9KbWxkegRr76XzA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@tybys/wasm-util": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.1.tgz", + "integrity": "sha512-9tTaPJLSiejZKx+Bmog4uSubteqTvFrVrURwkmHixBo0G4seD0zUxp98E1DzUBJxLQ3NPwXrGKDiVjwx/DpPsg==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@types/estree": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "24.10.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.1.tgz", + "integrity": "sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "undici-types": "~7.16.0" + } + }, + "node_modules/@types/react": { + "version": "19.2.7", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.7.tgz", + "integrity": "sha512-MWtvHrGZLFttgeEj28VXHxpmwYbor/ATPYbBfSFZEIRK0ecCFLl2Qo55z52Hss+UV9CRN7trSeq1zbgx7YDWWg==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "csstype": "^3.2.2" + } + }, + "node_modules/@types/react-dom": { + "version": "19.2.3", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.3.tgz", + "integrity": "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@types/react": "^19.2.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.48.1.tgz", + "integrity": "sha512-X63hI1bxl5ohelzr0LY5coufyl0LJNthld+abwxpCoo6Gq+hSqhKwci7MUWkXo67mzgUK6YFByhmaHmUcuBJmA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "8.48.1", + "@typescript-eslint/type-utils": "8.48.1", + "@typescript-eslint/utils": "8.48.1", + "@typescript-eslint/visitor-keys": "8.48.1", + "graphemer": "^1.4.0", + "ignore": "^7.0.0", + "natural-compare": "^1.4.0", + "ts-api-utils": "^2.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^8.48.1", + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", + "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.48.1.tgz", + "integrity": "sha512-PC0PDZfJg8sP7cmKe6L3QIL8GZwU5aRvUFedqSIpw3B+QjRSUZeeITC2M5XKeMXEzL6wccN196iy3JLwKNvDVA==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@typescript-eslint/scope-manager": "8.48.1", + "@typescript-eslint/types": "8.48.1", + "@typescript-eslint/typescript-estree": "8.48.1", + "@typescript-eslint/visitor-keys": "8.48.1", + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/project-service": { + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.48.1.tgz", + "integrity": "sha512-HQWSicah4s9z2/HifRPQ6b6R7G+SBx64JlFQpgSSHWPKdvCZX57XCbszg/bapbRsOEv42q5tayTYcEFpACcX1w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/tsconfig-utils": "^8.48.1", + "@typescript-eslint/types": "^8.48.1", + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.48.1.tgz", + "integrity": "sha512-rj4vWQsytQbLxC5Bf4XwZ0/CKd362DkWMUkviT7DCS057SK64D5lH74sSGzhI6PDD2HCEq02xAP9cX68dYyg1w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.48.1", + "@typescript-eslint/visitor-keys": "8.48.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/tsconfig-utils": { + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.48.1.tgz", + "integrity": "sha512-k0Jhs4CpEffIBm6wPaCXBAD7jxBtrHjrSgtfCjUvPp9AZ78lXKdTR8fxyZO5y4vWNlOvYXRtngSZNSn+H53Jkw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.48.1.tgz", + "integrity": "sha512-1jEop81a3LrJQLTf/1VfPQdhIY4PlGDBc/i67EVWObrtvcziysbLN3oReexHOM6N3jyXgCrkBsZpqwH0hiDOQg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.48.1", + "@typescript-eslint/typescript-estree": "8.48.1", + "@typescript-eslint/utils": "8.48.1", + "debug": "^4.3.4", + "ts-api-utils": "^2.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.48.1.tgz", + "integrity": "sha512-+fZ3LZNeiELGmimrujsDCT4CRIbq5oXdHe7chLiW8qzqyPMnn1puNstCrMNVAqwcl2FdIxkuJ4tOs/RFDBVc/Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.48.1.tgz", + "integrity": "sha512-/9wQ4PqaefTK6POVTjJaYS0bynCgzh6ClJHGSBj06XEHjkfylzB+A3qvyaXnErEZSaxhIo4YdyBgq6j4RysxDg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/project-service": "8.48.1", + "@typescript-eslint/tsconfig-utils": "8.48.1", + "@typescript-eslint/types": "8.48.1", + "@typescript-eslint/visitor-keys": "8.48.1", + "debug": "^4.3.4", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "tinyglobby": "^0.2.15", + "ts-api-utils": "^2.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { + "version": "7.7.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", + "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.48.1.tgz", + "integrity": "sha512-fAnhLrDjiVfey5wwFRwrweyRlCmdz5ZxXz2G/4cLn0YDLjTapmN4gcCsTBR1N2rWnZSDeWpYtgLDsJt+FpmcwA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.7.0", + "@typescript-eslint/scope-manager": "8.48.1", + "@typescript-eslint/types": "8.48.1", + "@typescript-eslint/typescript-estree": "8.48.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.48.1.tgz", + "integrity": "sha512-BmxxndzEWhE4TIEEMBs8lP3MBWN3jFPs/p6gPm/wkv02o41hI6cq9AuSmGAaTTHPtA1FTi2jBre4A9rm5ZmX+Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.48.1", + "eslint-visitor-keys": "^4.2.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@vitejs/plugin-react": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-6.0.1.tgz", + "integrity": "sha512-l9X/E3cDb+xY3SWzlG1MOGt2usfEHGMNIaegaUGFsLkb3RCn/k8/TOXBcab+OndDI4TBtktT8/9BwwW8Vi9KUQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@rolldown/pluginutils": "1.0.0-rc.7" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "peerDependencies": { + "@rolldown/plugin-babel": "^0.1.7 || ^0.2.0", + "babel-plugin-react-compiler": "^1.0.0", + "vite": "^8.0.0" + }, + "peerDependenciesMeta": { + "@rolldown/plugin-babel": { + "optional": true + }, + "babel-plugin-react-compiler": { + "optional": true + } + } + }, + "node_modules/acorn": { + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", + "dev": true, + "license": "MIT", + "peer": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true, + "license": "Python-2.0" + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/brace-expansion": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true, + "license": "MIT" + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/csstype": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", + "dev": true, + "license": "MIT" + }, + "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/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint": { + "version": "9.39.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.1.tgz", + "integrity": "sha512-BhHmn2yNOFA9H9JmmIVKJmd288g9hrVRDkdoIgRCRuSySRUHH7r/DI6aAXW9T1WwUuY3DFgrcaqB+deURBLR5g==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.8.0", + "@eslint-community/regexpp": "^4.12.1", + "@eslint/config-array": "^0.21.1", + "@eslint/config-helpers": "^0.4.2", + "@eslint/core": "^0.17.0", + "@eslint/eslintrc": "^3.3.1", + "@eslint/js": "9.39.1", + "@eslint/plugin-kit": "^0.4.1", + "@humanfs/node": "^0.16.6", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.4.2", + "@types/estree": "^1.0.6", + "ajv": "^6.12.4", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.6", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^8.4.0", + "eslint-visitor-keys": "^4.2.1", + "espree": "^10.4.0", + "esquery": "^1.5.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^8.0.0", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.1.2", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } + } + }, + "node_modules/eslint-plugin-react-hooks": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-5.2.0.tgz", + "integrity": "sha512-+f15FfK64YQwZdJNELETdn5ibXEUQmW1DZL6KXhNnc2heoy/sg9VJJeT7n8TlMWouzWqSWavFkIhHyIbIAEapg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0" + } + }, + "node_modules/eslint-plugin-react-refresh": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.4.24.tgz", + "integrity": "sha512-nLHIW7TEq3aLrEYWpVaJ1dRgFR+wLDPN8e8FpYAql/bMV2oBEfC37K0gLEGgv9fy66juNShSMV8OkTqzltcG/w==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "eslint": ">=8.40" + } + }, + "node_modules/eslint-scope": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz", + "integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", + "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/espree": { + "version": "10.4.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz", + "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "acorn": "^8.15.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^4.2.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/esquery": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.6.0.tgz", + "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", + "dev": true, + "license": "MIT" + }, + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/file-entry-cache": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz", + "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "flat-cache": "^4.0.0" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat-cache": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz", + "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==", + "dev": true, + "license": "MIT", + "dependencies": { + "flatted": "^3.2.9", + "keyv": "^4.5.4" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/flatted": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz", + "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==", + "dev": true, + "license": "ISC" + }, + "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/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/globals": { + "version": "16.5.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-16.5.0.tgz", + "integrity": "sha512-c/c15i26VrJ4IRt5Z89DnIzCGDn9EcebibhAOjw5ibqEHsE1wLUgkPn9RDmNcUKyU87GeaL633nyJ+pplFR2ZQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true, + "license": "MIT" + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz", + "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, + "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/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true, + "license": "ISC" + }, + "node_modules/js-yaml": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.1.tgz", + "integrity": "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA==", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true, + "license": "MIT" + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", + "dev": true, + "license": "MIT" + }, + "node_modules/keyv": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dev": true, + "license": "MIT", + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/lightningcss": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.32.0.tgz", + "integrity": "sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==", + "dev": true, + "license": "MPL-2.0", + "dependencies": { + "detect-libc": "^2.0.3" + }, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "optionalDependencies": { + "lightningcss-android-arm64": "1.32.0", + "lightningcss-darwin-arm64": "1.32.0", + "lightningcss-darwin-x64": "1.32.0", + "lightningcss-freebsd-x64": "1.32.0", + "lightningcss-linux-arm-gnueabihf": "1.32.0", + "lightningcss-linux-arm64-gnu": "1.32.0", + "lightningcss-linux-arm64-musl": "1.32.0", + "lightningcss-linux-x64-gnu": "1.32.0", + "lightningcss-linux-x64-musl": "1.32.0", + "lightningcss-win32-arm64-msvc": "1.32.0", + "lightningcss-win32-x64-msvc": "1.32.0" + } + }, + "node_modules/lightningcss-android-arm64": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.32.0.tgz", + "integrity": "sha512-YK7/ClTt4kAK0vo6w3X+Pnm0D2cf2vPHbhOXdoNti1Ga0al1P4TBZhwjATvjNwLEBCnKvjJc2jQgHXH0NEwlAg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-arm64": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.32.0.tgz", + "integrity": "sha512-RzeG9Ju5bag2Bv1/lwlVJvBE3q6TtXskdZLLCyfg5pt+HLz9BqlICO7LZM7VHNTTn/5PRhHFBSjk5lc4cmscPQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-darwin-x64": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.32.0.tgz", + "integrity": "sha512-U+QsBp2m/s2wqpUYT/6wnlagdZbtZdndSmut/NJqlCcMLTWp5muCrID+K5UJ6jqD2BFshejCYXniPDbNh73V8w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-freebsd-x64": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.32.0.tgz", + "integrity": "sha512-JCTigedEksZk3tHTTthnMdVfGf61Fky8Ji2E4YjUTEQX14xiy/lTzXnu1vwiZe3bYe0q+SpsSH/CTeDXK6WHig==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm-gnueabihf": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.32.0.tgz", + "integrity": "sha512-x6rnnpRa2GL0zQOkt6rts3YDPzduLpWvwAF6EMhXFVZXD4tPrBkEFqzGowzCsIWsPjqSK+tyNEODUBXeeVHSkw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-gnu": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.32.0.tgz", + "integrity": "sha512-0nnMyoyOLRJXfbMOilaSRcLH3Jw5z9HDNGfT/gwCPgaDjnx0i8w7vBzFLFR1f6CMLKF8gVbebmkUN3fa/kQJpQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-arm64-musl": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.32.0.tgz", + "integrity": "sha512-UpQkoenr4UJEzgVIYpI80lDFvRmPVg6oqboNHfoH4CQIfNA+HOrZ7Mo7KZP02dC6LjghPQJeBsvXhJod/wnIBg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-gnu": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.32.0.tgz", + "integrity": "sha512-V7Qr52IhZmdKPVr+Vtw8o+WLsQJYCTd8loIfpDaMRWGUZfBOYEJeyJIkqGIDMZPwPx24pUMfwSxxI8phr/MbOA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-linux-x64-musl": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.32.0.tgz", + "integrity": "sha512-bYcLp+Vb0awsiXg/80uCRezCYHNg1/l3mt0gzHnWV9XP1W5sKa5/TCdGWaR/zBM2PeF/HbsQv/j2URNOiVuxWg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-arm64-msvc": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.32.0.tgz", + "integrity": "sha512-8SbC8BR40pS6baCM8sbtYDSwEVQd4JlFTOlaD3gWGHfThTcABnNDBda6eTZeqbofalIJhFx0qKzgHJmcPTnGdw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/lightningcss-win32-x64-msvc": { + "version": "1.32.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.32.0.tgz", + "integrity": "sha512-Amq9B/SoZYdDi1kFrojnoqPLxYhQ4Wo5XiL8EVJrVsB8ARoC1PWW6VGtT0WKCemjy8aC+louJnjS7U18x3b06Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + } + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "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/nanoid": { + "version": "3.3.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true, + "license": "MIT" + }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "license": "MIT", + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "license": "MIT", + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "dev": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/postcss": { + "version": "8.5.8", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.8.tgz", + "integrity": "sha512-OW/rX8O/jXnm82Ey1k44pObPtdblfiuWnrd8X7GJ7emImCOstunGbXUpp7HdBrFQX6rJzn3sPT397Wp5aCwCHg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.11", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/react": { + "version": "19.2.1", + "resolved": "https://registry.npmjs.org/react/-/react-19.2.1.tgz", + "integrity": "sha512-DGrYcCWK7tvYMnWh79yrPHt+vdx9tY+1gPZa7nJQtO/p8bLTDaHp4dzwEhQB7pZ4Xe3ok4XKuEPrVuc+wlpkmw==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "19.2.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.1.tgz", + "integrity": "sha512-ibrK8llX2a4eOskq1mXKu/TGZj9qzomO+sNfO98M6d9zIPOEhlBkMkBUBLd1vgS0gQsLDBzA+8jJBVXDnfHmJg==", + "license": "MIT", + "dependencies": { + "scheduler": "^0.27.0" + }, + "peerDependencies": { + "react": "^19.2.1" + } + }, + "node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/rolldown": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.0.0-rc.9.tgz", + "integrity": "sha512-9EbgWge7ZH+yqb4d2EnELAntgPTWbfL8ajiTW+SyhJEC4qhBbkCKbqFV4Ge4zmu5ziQuVbWxb/XwLZ+RIO7E8Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@oxc-project/types": "=0.115.0", + "@rolldown/pluginutils": "1.0.0-rc.9" + }, + "bin": { + "rolldown": "bin/cli.mjs" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "optionalDependencies": { + "@rolldown/binding-android-arm64": "1.0.0-rc.9", + "@rolldown/binding-darwin-arm64": "1.0.0-rc.9", + "@rolldown/binding-darwin-x64": "1.0.0-rc.9", + "@rolldown/binding-freebsd-x64": "1.0.0-rc.9", + "@rolldown/binding-linux-arm-gnueabihf": "1.0.0-rc.9", + "@rolldown/binding-linux-arm64-gnu": "1.0.0-rc.9", + "@rolldown/binding-linux-arm64-musl": "1.0.0-rc.9", + "@rolldown/binding-linux-ppc64-gnu": "1.0.0-rc.9", + "@rolldown/binding-linux-s390x-gnu": "1.0.0-rc.9", + "@rolldown/binding-linux-x64-gnu": "1.0.0-rc.9", + "@rolldown/binding-linux-x64-musl": "1.0.0-rc.9", + "@rolldown/binding-openharmony-arm64": "1.0.0-rc.9", + "@rolldown/binding-wasm32-wasi": "1.0.0-rc.9", + "@rolldown/binding-win32-arm64-msvc": "1.0.0-rc.9", + "@rolldown/binding-win32-x64-msvc": "1.0.0-rc.9" + } + }, + "node_modules/rolldown/node_modules/@rolldown/pluginutils": { + "version": "1.0.0-rc.9", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-rc.9.tgz", + "integrity": "sha512-w6oiRWgEBl04QkFZgmW+jnU1EC9b57Oihi2ot3HNWIQRqgHp5PnYDia5iZ5FF7rpa4EQdiqMDXjlqKGXBhsoXw==", + "dev": true, + "license": "MIT" + }, + "node_modules/scheduler": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz", + "integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==", + "license": "MIT" + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.15", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", + "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.3" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/ts-api-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.1.0.tgz", + "integrity": "sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.12" + }, + "peerDependencies": { + "typescript": ">=4.8.4" + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "dev": true, + "license": "0BSD", + "optional": true + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "license": "MIT", + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "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", + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/typescript-eslint": { + "version": "8.48.1", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.48.1.tgz", + "integrity": "sha512-FbOKN1fqNoXp1hIl5KYpObVrp0mCn+CLgn479nmu2IsRMrx2vyv74MmsBLVlhg8qVwNFGbXSp8fh1zp8pEoC2A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.48.1", + "@typescript-eslint/parser": "8.48.1", + "@typescript-eslint/typescript-estree": "8.48.1", + "@typescript-eslint/utils": "8.48.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/undici-types": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", + "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", + "dev": true, + "license": "MIT" + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/vite": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/vite/-/vite-8.0.0.tgz", + "integrity": "sha512-fPGaRNj9Zytaf8LEiBhY7Z6ijnFKdzU/+mL8EFBaKr7Vw1/FWcTBAMW0wLPJAGMPX38ZPVCVgLceWiEqeoqL2Q==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@oxc-project/runtime": "0.115.0", + "lightningcss": "^1.32.0", + "picomatch": "^4.0.3", + "postcss": "^8.5.8", + "rolldown": "1.0.0-rc.9", + "tinyglobby": "^0.2.15" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "@vitejs/devtools": "^0.0.0-alpha.31", + "esbuild": "^0.27.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "@vitejs/devtools": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + } +} diff --git a/src/Aspire.Cli/Templating/Templates/java-starter/frontend/package.json b/src/Aspire.Cli/Templating/Templates/java-starter/frontend/package.json new file mode 100644 index 00000000000..e684fdb3139 --- /dev/null +++ b/src/Aspire.Cli/Templating/Templates/java-starter/frontend/package.json @@ -0,0 +1,33 @@ +{ + "name": "frontend", + "private": true, + "version": "0.0.0", + "type": "module", + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "scripts": { + "dev": "vite", + "build": "tsc -b && vite build", + "lint": "eslint .", + "preview": "vite preview" + }, + "dependencies": { + "react": "^19.2.1", + "react-dom": "^19.2.1" + }, + "devDependencies": { + "@eslint/js": "^9.39.1", + "@types/node": "^24.10.1", + "@types/react": "^19.2.7", + "@types/react-dom": "^19.2.3", + "@vitejs/plugin-react": "^6.0.0", + "eslint": "^9.39.1", + "eslint-plugin-react-hooks": "^5.2.0", + "eslint-plugin-react-refresh": "^0.4.24", + "globals": "^16.5.0", + "typescript": "~5.9.3", + "typescript-eslint": "^8.48.1", + "vite": "^8.0.0" + } +} diff --git a/src/Aspire.Cli/Templating/Templates/java-starter/frontend/public/Aspire.png b/src/Aspire.Cli/Templating/Templates/java-starter/frontend/public/Aspire.png new file mode 100644 index 00000000000..d4be662a618 Binary files /dev/null and b/src/Aspire.Cli/Templating/Templates/java-starter/frontend/public/Aspire.png differ diff --git a/src/Aspire.Cli/Templating/Templates/java-starter/frontend/public/github.svg b/src/Aspire.Cli/Templating/Templates/java-starter/frontend/public/github.svg new file mode 100644 index 00000000000..162a4a43a35 --- /dev/null +++ b/src/Aspire.Cli/Templating/Templates/java-starter/frontend/public/github.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/Aspire.Cli/Templating/Templates/java-starter/frontend/src/App.css b/src/Aspire.Cli/Templating/Templates/java-starter/frontend/src/App.css new file mode 100644 index 00000000000..1f690dea729 --- /dev/null +++ b/src/Aspire.Cli/Templating/Templates/java-starter/frontend/src/App.css @@ -0,0 +1,794 @@ +/* CSS Variables for theming */ +:root { + --bg-gradient-start: #1a1a2e; + --bg-gradient-end: #16213e; + --card-bg: rgba(30, 30, 46, 0.95); + --card-hover-shadow: rgba(0, 0, 0, 0.3); + --text-primary: #ffffff; + --text-secondary: #e2e8f0; + --text-tertiary: #cbd5e0; + --accent-gradient-start: #7c92f5; + --accent-gradient-end: #8b5ecf; + --weather-card-bg: rgba(45, 45, 60, 0.8); + --weather-card-border: rgba(255, 255, 255, 0.1); + --section-title-color: #f7fafc; + --date-color: #cbd5e0; + --summary-color: #f7fafc; + --temp-unit-color: #e2e8f0; + --divider-color: #4a5568; + --error-bg: rgba(220, 38, 38, 0.1); + --error-border: #ef4444; + --error-text: #fca5a5; + --skeleton-bg-1: rgba(255, 255, 255, 0.05); + --skeleton-bg-2: rgba(255, 255, 255, 0.1); + --tile-min-height: 120px; + --tile-gap: 0.75rem; + --cta-height: 3rem; + --card-inner-gap: 1rem; + --focus-color: #a78bfa; +} + +@media (prefers-color-scheme: light) { + :root { + --bg-gradient-start: #f0f4ff; + --bg-gradient-end: #e0e7ff; + --card-bg: rgba(255, 255, 255, 0.98); + --card-hover-shadow: rgba(0, 0, 0, 0.15); + --text-primary: #1a202c; + --text-secondary: #2d3748; + --text-tertiary: #4a5568; + --accent-gradient-start: #5b6fd8; + --accent-gradient-end: #6b46a3; + --weather-card-bg: rgba(255, 255, 255, 0.9); + --weather-card-border: rgba(102, 126, 234, 0.15); + --section-title-color: #1a202c; + --date-color: #2d3748; + --summary-color: #1a202c; + --temp-unit-color: #4a5568; + --divider-color: #cbd5e0; + --error-bg: #fee; + --error-border: #dc2626; + --error-text: #991b1b; + --skeleton-bg-1: #f0f0f0; + --skeleton-bg-2: #e0e0e0; + --tile-min-height: 120px; + --tile-gap: 0.75rem; + --cta-height: 3rem; + --card-inner-gap: 1rem; + --focus-color: #5b21b6; + } +} + +/* Root container */ +#root { + width: 100%; + min-height: 100vh; + display: flex; + flex-direction: column; + overflow-x: hidden; +} + +/* Accessibility utilities */ +.visually-hidden { + position: absolute; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + white-space: nowrap; + border-width: 0; +} + +/* App container */ +.app-container { + width: 100%; + min-height: 100vh; + display: flex; + flex-direction: column; + background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%); + color: var(--text-primary); +} + +/* Header */ +.app-header { + padding: 2.5rem 2rem 1.5rem; + text-align: center; + animation: fadeInDown 0.6s ease-out; +} + +.logo-link { + display: inline-block; + border-radius: 0.5rem; +} + +.logo-link:focus-visible { + outline: 3px solid var(--accent-gradient-end); + outline-offset: 8px; +} + +.logo { + height: 5rem; + width: auto; + transition: transform 300ms ease, filter 300ms ease; + filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2)); +} + +.logo:hover { + transform: scale(1.1) rotate(5deg); + filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.3)); +} + +.app-title { + font-size: 2.75rem; + font-weight: 700; + margin: 1.25rem 0 0.5rem; + background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + background-clip: text; + letter-spacing: -0.02em; +} + +.app-subtitle { + font-size: 1.05rem; + color: var(--text-tertiary); + margin: 0; + font-weight: 300; +} + +/* Main content */ +.main-content { + flex: 1; + max-width: 1400px; + width: 100%; + margin: 0 auto; + padding: 0rem 2rem 2rem; + display: flex; + justify-content: center; + align-items: center; +} + +/* Card styles */ +.card { + background: var(--card-bg); + backdrop-filter: blur(10px); + border-radius: 1rem; + padding: 1.25rem 1.5rem; + box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1); + color: var(--text-primary); + animation: fadeInUp 0.6s ease-out; + border: 1px solid var(--weather-card-border); + display: flex; + flex-direction: column; + gap: var(--card-inner-gap); +} + +/* Section styles */ +.demo-section { + animation: fadeInUp 0.6s ease-out; +} + +.weather-section { + animation: fadeInUp 0.6s ease-out; + animation-delay: 0.1s; + flex: 1; + max-width: 1200px; + width: 100%; +} + +.section-header { + display: flex; + justify-content: space-between; + align-items: flex-start; + margin-bottom: 0; + flex-wrap: wrap; + gap: 1rem; +} + +.header-actions { + display: flex; + gap: 0.75rem; + align-items: center; +} + +.section-title { + font-size: 1.25rem; + font-weight: 600; + margin: 0; + color: var(--section-title-color); +} + +/* Counter area */ +.counter-card .section-header { + margin-bottom: 0; +} + +.counter-panel { + background: var(--weather-card-bg); + border-radius: 0.75rem; + border: 1px solid var(--weather-card-border); + padding: 1.25rem; + display: flex; + flex-direction: column; + gap: var(--tile-gap); + min-height: var(--tile-min-height); + backdrop-filter: blur(10px); + flex: 1; +} + +.counter-value-group { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + gap: 0.25rem; + flex: 1; + margin-bottom: var(--tile-gap); + text-align: center; +} + +.counter-label { + font-size: 0.75rem; + text-transform: uppercase; + letter-spacing: 0.1em; + color: var(--text-tertiary); + font-weight: 600; +} + +.counter-value { + font-size: 2.25rem; + font-weight: 700; + line-height: 1; + background: linear-gradient(135deg, var(--accent-gradient-start) 0%, var(--accent-gradient-end) 100%); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + background-clip: text; +} + +.increment-button { + display: flex; + align-items: center; + justify-content: center; + gap: 0.5rem; + background: linear-gradient(135deg, var(--accent-gradient-start) 0%, var(--accent-gradient-end) 100%); + color: white; + border: none; + border-radius: 0.5rem; + padding: 0 1.5rem; + height: var(--cta-height); + font-size: 0.875rem; + font-weight: 600; + cursor: pointer; + transition: all 0.3s ease; + box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3); + width: 100%; + margin-top: auto; +} + +.increment-button:hover { + transform: translateY(-1px); + box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4); +} + +.increment-button:active { + transform: translateY(0); +} + +.increment-button:focus-visible { + outline: 3px solid var(--accent-gradient-end); + outline-offset: 2px; +} + +.increment-icon { + transition: transform 0.3s ease; +} + +.increment-button:hover .increment-icon { + transform: scale(1.1); +} + +/* Toggle switch */ +.toggle-switch { + display: flex; + background: rgba(255, 255, 255, 0.1); + border-radius: 0.5rem; + padding: 0.25rem; + gap: 0.25rem; + border: 1px solid var(--weather-card-border); + margin: 0; + padding: 0.25rem; + min-width: 0; +} + +.toggle-switch legend { + padding: 0; +} + +@media (prefers-color-scheme: light) { + .toggle-switch { + background: rgba(102, 126, 234, 0.08); + } +} + +.toggle-option { + display: flex; + align-items: center; + justify-content: center; + background: transparent; + color: var(--text-secondary); + border: none; + border-radius: 0.375rem; + padding: 0 1rem; + height: 2.5rem; + font-size: 0.875rem; + font-weight: 600; + cursor: pointer; + transition: all 0.3s ease; + min-width: 3rem; + position: relative; +} + +.toggle-option[aria-pressed="true"] { + background: linear-gradient(135deg, var(--accent-gradient-start) 0%, var(--accent-gradient-end) 100%); + color: white; + box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3); +} + +.toggle-option[aria-pressed="false"]:hover { + background: rgba(255, 255, 255, 0.05); + color: var(--text-primary); +} + +@media (prefers-color-scheme: light) { + .toggle-option[aria-pressed="false"]:hover { + background: rgba(102, 126, 234, 0.1); + } +} + +.toggle-option:focus-visible { + outline: 3px solid var(--focus-color); + outline-offset: 2px; + z-index: 1; +} + +/* Refresh button */ +.refresh-button { + display: flex; + align-items: center; + justify-content: center; + gap: 0.5rem; + background: linear-gradient(135deg, var(--accent-gradient-start) 0%, var(--accent-gradient-end) 100%); + color: white; + border: none; + border-radius: 0.5rem; + padding: 0 1.5rem; + height: var(--cta-height); + font-size: 0.875rem; + font-weight: 600; + cursor: pointer; + transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease; + box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3); + min-width: 140px; + white-space: nowrap; +} + +.refresh-button:hover:not(:disabled) { + transform: translateY(-1px); + box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4); +} + +.refresh-button:disabled { + opacity: 0.6; + cursor: not-allowed; + transform: none; +} + +.refresh-button:focus-visible { + outline: 3px solid var(--focus-color); + outline-offset: 3px; +} + +.refresh-icon { + transition: transform 0.3s ease; +} + +.refresh-icon.spinning { + animation: spin 1s linear infinite; +} + +/* Error message */ +.error-message { + display: flex; + align-items: center; + gap: 0.75rem; + background-color: var(--error-bg); + border-left: 4px solid var(--error-border); + color: var(--error-text); + padding: 1rem; + border-radius: 0.5rem; + margin: 1rem 0; + animation: slideIn 0.3s ease-out; +} + +/* Loading skeleton */ +.loading-skeleton { + display: flex; + flex-direction: column; + gap: 1rem; + margin-top: 1rem; +} + +.skeleton-row { + height: 80px; + background: linear-gradient(90deg, var(--skeleton-bg-1) 25%, var(--skeleton-bg-2) 50%, var(--skeleton-bg-1) 75%); + background-size: 200% 100%; + animation: shimmer 1.5s infinite; + border-radius: 0.5rem; +} + +/* Weather grid */ +.weather-grid { + display: grid; + grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); + gap: 1rem; + margin-top: 0.75rem; +} + +.weather-card { + background: var(--weather-card-bg); + border-radius: 0.75rem; + padding: 1.25rem; + display: flex; + flex-direction: column; + gap: 0.75rem; + transition: all 0.3s ease; + border: 1px solid var(--weather-card-border); + backdrop-filter: blur(10px); + min-height: var(--tile-min-height); +} + +.weather-card:hover { + transform: translateY(-4px); + box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2); +} + +.weather-card:focus-within { + outline: 2px solid var(--focus-color); + outline-offset: 2px; +} + +.weather-date { + font-weight: 600; + font-size: 0.875rem; + color: var(--date-color); + text-transform: uppercase; + letter-spacing: 0.05em; + margin: 0; +} + +.weather-summary { + font-size: 1.125rem; + font-weight: 500; + color: var(--summary-color); + min-height: 1.5rem; + margin: 0; +} + +.weather-temps { + display: flex; + align-items: center; + justify-content: center; + gap: 0.75rem; + margin-top: 0.5rem; + padding-top: 0.75rem; + border-top: 1px solid var(--weather-card-border); +} + +.temp-group { + display: flex; + flex-direction: column; + align-items: center; + width: 100%; +} + +.temp-value { + font-size: 1.5rem; + font-weight: 700; + background: linear-gradient(135deg, var(--accent-gradient-start) 0%, var(--accent-gradient-end) 100%); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + background-clip: text; +} + +.temp-unit { + font-size: 0.75rem; + color: var(--temp-unit-color); + margin-top: 0.125rem; +} + +/* Responsive design */ +@media (max-width: 1024px) { + .main-content { + padding: 1rem; + } +} +.app-footer { + padding: 1.5rem; + text-align: center; + background: rgba(0, 0, 0, 0.2); + backdrop-filter: blur(10px); +} + +.app-footer nav { + display: flex; + justify-content: center; + align-items: center; + gap: 1.5rem; +} + +.app-footer a { + color: var(--text-secondary); + text-decoration: none; + font-weight: 500; + transition: color 0.3s ease, border-color 0.3s ease; + border-bottom: 2px solid transparent; + font-size: 0.875rem; + padding-bottom: 0.125rem; +} + +.app-footer a:hover { + color: var(--text-primary); + border-bottom-color: var(--text-primary); +} + +.app-footer a:focus-visible { + outline: 3px solid var(--focus-color); + outline-offset: 4px; + border-radius: 4px; +} + +/* Animations */ +@keyframes fadeInDown { + from { + opacity: 0; + transform: translateY(-20px); + } + to { + opacity: 1; + transform: translateY(0); + } +} + +@keyframes fadeInUp { + from { + opacity: 0; + transform: translateY(20px); + } + to { + opacity: 1; + transform: translateY(0); + } +} + +@keyframes slideIn { + from { + opacity: 0; + transform: translateX(-10px); + } + to { + opacity: 1; + transform: translateX(0); + } +} + +@keyframes spin { + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } +} + +@keyframes shimmer { + 0% { + background-position: -200% 0; + } + 100% { + background-position: 200% 0; + } +} + +/* Responsive design */ +@media (max-width: 1024px) { + .main-content { + grid-template-columns: 1fr; + padding: 1rem; + gap: 1rem; + } +} + +/* Footer */ +.app-footer { + padding: 1.5rem 0; + text-align: center; + background: rgba(0, 0, 0, 0.2); + backdrop-filter: blur(10px); + display: flex; + justify-content: center; + align-items: center; +} + +.app-footer > * { + max-width: 1400px; + width: 100%; + display: flex; + justify-content: space-between; + align-items: center; + padding: 0 2rem; + gap: 1rem; +} + +.app-footer a { + color: var(--text-secondary); + text-decoration: none; + font-weight: 500; + transition: color 0.3s ease, transform 0.3s ease; + border-bottom: 2px solid transparent; + font-size: 0.875rem; +} + +.app-footer a:hover { + color: var(--text-primary); + border-bottom-color: var(--text-primary); +} + +.app-footer a:focus-visible { + outline: 2px solid var(--text-primary); + outline-offset: 4px; + border-radius: 2px; +} + +.github-link { + display: inline-flex; + align-items: center; + gap: 0.5rem; + border-bottom: none !important; +} + +.github-link:focus-visible { + outline: 3px solid var(--focus-color); + outline-offset: 4px; + border-radius: 4px; +} + +.github-link img { + transition: transform 0.3s ease, opacity 0.3s ease; + filter: brightness(0) invert(1); +} + +@media (prefers-color-scheme: light) { + .github-link img { + filter: brightness(0) invert(0); + opacity: 0.7; + } + + .github-link:hover img { + opacity: 1; + } +} + +.github-link:hover img { + transform: scale(1.1); +} + +@media (max-width: 768px) { + :root { + --cta-height: 2.75rem; + } + + .app-header { + padding: 1.5rem 1rem 1rem; + } + + .logo { + height: 3rem; + } + + .app-title { + font-size: 1.5rem; + } + + .app-subtitle { + font-size: 0.875rem; + } + + .main-content { + padding: 0.75rem; + } + + .card { + padding: 1rem; + } + + .section-title { + font-size: 1.125rem; + } + + .section-header { + flex-direction: column; + align-items: stretch; + gap: 0.75rem; + } + + .header-actions { + width: 100%; + } + + .toggle-switch { + flex: 1; + } + + .toggle-option { + flex: 1; + } + + .refresh-button { + flex: 1; + justify-content: center; + padding: 0 1.25rem; + } + + .weather-grid { + grid-template-columns: 1fr; + gap: 0.75rem; + } + + .weather-card { + padding: 1.25rem; + } + + .app-footer { + padding: 1rem 0; + } + + .app-footer > * { + flex-direction: column; + padding: 0 1.5rem; + } + + .github-link { + order: -1; + } +} + +/* Reduced motion support */ +@media (prefers-reduced-motion: reduce) { + *, + *::before, + *::after { + animation-duration: 0.01ms !important; + animation-iteration-count: 1 !important; + transition-duration: 0.01ms !important; + } +} + +/* High contrast mode support */ +@media (prefers-contrast: high) { + .card { + border: 2px solid currentColor; + } + + .weather-card { + border: 1px solid currentColor; + } +} + +/* Focus visible support for better keyboard navigation */ +*:focus-visible { + outline: 3px solid var(--accent-gradient-end); + outline-offset: 2px; +} + diff --git a/src/Aspire.Cli/Templating/Templates/java-starter/frontend/src/App.tsx b/src/Aspire.Cli/Templating/Templates/java-starter/frontend/src/App.tsx new file mode 100644 index 00000000000..b9b5a1b10ae --- /dev/null +++ b/src/Aspire.Cli/Templating/Templates/java-starter/frontend/src/App.tsx @@ -0,0 +1,184 @@ +import { useState, useEffect } from 'react'; +import aspireLogo from '/Aspire.png'; +import './App.css'; + +interface WeatherForecast { + date: string; + temperatureC: number; + temperatureF: number; + summary: string; +} + +function App() { + const [weatherData, setWeatherData] = useState([]); + const [loading, setLoading] = useState(false); + const [error, setError] = useState(null); + const [useCelsius, setUseCelsius] = useState(false); + + const fetchWeatherForecast = async () => { + setLoading(true); + setError(null); + + try { + const response = await fetch('/api/weatherforecast'); + + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + + const data: WeatherForecast[] = await response.json(); + setWeatherData(data); + } catch (err) { + setError(err instanceof Error ? err.message : 'Failed to fetch weather data'); + console.error('Error fetching weather forecast:', err); + } finally { + setLoading(false); + } + }; + + useEffect(() => { + fetchWeatherForecast(); + }, []); + + const formatDate = (dateString: string) => { + return new Date(dateString).toLocaleDateString(undefined, { + weekday: 'short', + month: 'short', + day: 'numeric' + }); + }; + + return ( +
+
+ + Aspire logo + +

Aspire Starter

+

Modern distributed application development

+
+ +
+
+
+
+

Weather Forecast

+
+
+ Temperature unit + + +
+ +
+
+ + {error && ( +
+ + {error} +
+ )} + + {loading && weatherData.length === 0 && ( +
+ {[...Array(5)].map((_, i) => ( + + )} + + {weatherData.length > 0 && ( +
+ {weatherData.map((forecast, index) => ( +
+

+ +

+

{forecast.summary}

+
+
+ + +
+
+
+ ))} +
+ )} +
+
+
+ + +
+ ); +} + +export default App; diff --git a/src/Aspire.Cli/Templating/Templates/java-starter/frontend/src/index.css b/src/Aspire.Cli/Templating/Templates/java-starter/frontend/src/index.css new file mode 100644 index 00000000000..6d1b6557354 --- /dev/null +++ b/src/Aspire.Cli/Templating/Templates/java-starter/frontend/src/index.css @@ -0,0 +1,55 @@ +:root { + font-family: system-ui, Avenir, Helvetica, Arial, sans-serif; + line-height: 1.5; + font-weight: 400; + + color-scheme: light dark; + + font-synthesis: none; + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +/* Reset and base styles */ +*, +*::before, +*::after { + box-sizing: border-box; +} + +html { + margin: 0; + padding: 0; + width: 100%; + height: 100%; + overflow-x: hidden; +} + +body { + margin: 0; + padding: 0; + width: 100%; + min-height: 100vh; + overflow-x: hidden; +} + +/* Remove default Vite styles that conflict with our design */ +h1 { + margin: 0; +} + +button { + font-family: inherit; + cursor: pointer; +} + +@media (prefers-reduced-motion: reduce) { + *, + *::before, + *::after { + animation-duration: 0.01ms !important; + animation-iteration-count: 1 !important; + transition-duration: 0.01ms !important; + } +} diff --git a/src/Aspire.Cli/Templating/Templates/java-starter/frontend/src/main.tsx b/src/Aspire.Cli/Templating/Templates/java-starter/frontend/src/main.tsx new file mode 100644 index 00000000000..2239905c14d --- /dev/null +++ b/src/Aspire.Cli/Templating/Templates/java-starter/frontend/src/main.tsx @@ -0,0 +1,10 @@ +import { StrictMode } from 'react'; +import { createRoot } from 'react-dom/client'; +import './index.css'; +import App from './App.tsx'; + +createRoot(document.getElementById('root')!).render( + + + , +); diff --git a/src/Aspire.Cli/Templating/Templates/java-starter/frontend/src/vite-env.d.ts b/src/Aspire.Cli/Templating/Templates/java-starter/frontend/src/vite-env.d.ts new file mode 100644 index 00000000000..11f02fe2a00 --- /dev/null +++ b/src/Aspire.Cli/Templating/Templates/java-starter/frontend/src/vite-env.d.ts @@ -0,0 +1 @@ +/// diff --git a/src/Aspire.Cli/Templating/Templates/java-starter/frontend/tsconfig.app.json b/src/Aspire.Cli/Templating/Templates/java-starter/frontend/tsconfig.app.json new file mode 100644 index 00000000000..c9ccbd4c594 --- /dev/null +++ b/src/Aspire.Cli/Templating/Templates/java-starter/frontend/tsconfig.app.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo", + "target": "ES2020", + "useDefineForClassFields": true, + "lib": ["ES2020", "DOM", "DOM.Iterable"], + "module": "ESNext", + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "moduleDetection": "force", + "noEmit": true, + "jsx": "react-jsx", + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "erasableSyntaxOnly": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedSideEffectImports": true + }, + "include": ["src"] +} diff --git a/src/Aspire.Cli/Templating/Templates/java-starter/frontend/tsconfig.json b/src/Aspire.Cli/Templating/Templates/java-starter/frontend/tsconfig.json new file mode 100644 index 00000000000..1ffef600d95 --- /dev/null +++ b/src/Aspire.Cli/Templating/Templates/java-starter/frontend/tsconfig.json @@ -0,0 +1,7 @@ +{ + "files": [], + "references": [ + { "path": "./tsconfig.app.json" }, + { "path": "./tsconfig.node.json" } + ] +} diff --git a/src/Aspire.Cli/Templating/Templates/java-starter/frontend/tsconfig.node.json b/src/Aspire.Cli/Templating/Templates/java-starter/frontend/tsconfig.node.json new file mode 100644 index 00000000000..9728af2d81a --- /dev/null +++ b/src/Aspire.Cli/Templating/Templates/java-starter/frontend/tsconfig.node.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", + "target": "ES2022", + "lib": ["ES2023"], + "module": "ESNext", + "skipLibCheck": true, + + /* Bundler mode */ + "moduleResolution": "bundler", + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "moduleDetection": "force", + "noEmit": true, + + /* Linting */ + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "erasableSyntaxOnly": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedSideEffectImports": true + }, + "include": ["vite.config.ts"] +} diff --git a/src/Aspire.Cli/Templating/Templates/java-starter/frontend/vite.config.ts b/src/Aspire.Cli/Templating/Templates/java-starter/frontend/vite.config.ts new file mode 100644 index 00000000000..a11dd97e3bf --- /dev/null +++ b/src/Aspire.Cli/Templating/Templates/java-starter/frontend/vite.config.ts @@ -0,0 +1,16 @@ +import { defineConfig } from 'vite'; +import react from '@vitejs/plugin-react'; + +// https://vite.dev/config/ +export default defineConfig({ + plugins: [react()], + server: { + proxy: { + // Proxy API calls to the Express service + '/api': { + target: process.env.APP_HTTPS || process.env.APP_HTTP, + changeOrigin: true + } + } + } +}); diff --git a/src/Aspire.Hosting.CodeGeneration.Java/AtsJavaCodeGenerator.cs b/src/Aspire.Hosting.CodeGeneration.Java/AtsJavaCodeGenerator.cs index a117af08ff5..3c1b88482b8 100644 --- a/src/Aspire.Hosting.CodeGeneration.Java/AtsJavaCodeGenerator.cs +++ b/src/Aspire.Hosting.CodeGeneration.Java/AtsJavaCodeGenerator.cs @@ -29,6 +29,9 @@ public sealed class AtsJavaCodeGenerator : ICodeGenerator private readonly Dictionary _classNames = new(StringComparer.Ordinal); private readonly Dictionary _dtoNames = new(StringComparer.Ordinal); private readonly Dictionary _enumNames = new(StringComparer.Ordinal); + private readonly Dictionary> _optionsClassesToGenerate = new(StringComparer.Ordinal); + private readonly Dictionary _capabilityOptionsClassMap = new(StringComparer.Ordinal); + private readonly HashSet _resourceBuilderHandleClasses = new(StringComparer.Ordinal); /// public string Language => "Java"; @@ -36,12 +39,20 @@ public sealed class AtsJavaCodeGenerator : ICodeGenerator /// public Dictionary GenerateDistributedApplication(AtsContext context) { - return new Dictionary(StringComparer.Ordinal) - { - ["Transport.java"] = GetEmbeddedResource("Transport.java"), - ["Base.java"] = GetEmbeddedResource("Base.java"), - ["Aspire.java"] = GenerateAspireSdk(context) - }; + var files = new Dictionary(StringComparer.Ordinal); + + AddSplitJavaSourceFiles(files, GetEmbeddedResource("Transport.java")); + AddSplitJavaSourceFiles(files, GetEmbeddedResource("Base.java")); + AddSplitJavaSourceFiles(files, GenerateAspireSdk(context)); + + files["sources.txt"] = string.Join( + '\n', + files.Keys + .Where(static key => key.EndsWith(".java", StringComparison.Ordinal)) + .OrderBy(static key => key, StringComparer.Ordinal) + .Select(static key => $".modules/{key}")) + '\n'; + + return files; } private static string GetEmbeddedResource(string name) @@ -55,6 +66,327 @@ private static string GetEmbeddedResource(string name) return reader.ReadToEnd(); } + private static void AddSplitJavaSourceFiles(Dictionary files, string source) + { + foreach (var (fileName, content) in SplitJavaSourceFiles(source)) + { + files.Add(fileName, content); + } + } + + private static Dictionary SplitJavaSourceFiles(string source) + { + var packageLine = string.Empty; + var importLines = new List(); + var declarations = new Dictionary(StringComparer.Ordinal); + + var lines = source.Replace("\r\n", "\n", StringComparison.Ordinal).Split('\n'); + var bodyStartIndex = 0; + + for (var i = 0; i < lines.Length; i++) + { + var trimmed = lines[i].Trim(); + if (trimmed.StartsWith("package ", StringComparison.Ordinal)) + { + packageLine = trimmed; + continue; + } + + if (string.IsNullOrEmpty(packageLine)) + { + continue; + } + + if (trimmed.StartsWith("import ", StringComparison.Ordinal)) + { + importLines.Add(trimmed); + continue; + } + + if (string.IsNullOrWhiteSpace(trimmed) || trimmed.StartsWith("//", StringComparison.Ordinal)) + { + continue; + } + + bodyStartIndex = i; + break; + } + + List? currentDeclaration = null; + List? pendingLines = []; + string? currentTypeName = null; + var braceDepth = 0; + var inBlockComment = false; + + for (var i = bodyStartIndex; i < lines.Length; i++) + { + var line = lines[i]; + var trimmed = line.Trim(); + + if (currentDeclaration is null) + { + if (TryGetTopLevelDeclarationName(trimmed, out var declarationName)) + { + currentTypeName = declarationName; + currentDeclaration = []; + + if (pendingLines.Count > 0) + { + currentDeclaration.AddRange(pendingLines); + pendingLines.Clear(); + } + + currentDeclaration.Add(PromoteTopLevelDeclaration(line)); + braceDepth = CountBraceDelta(line, ref inBlockComment); + continue; + } + + if (ShouldPreserveTopLevelLine(trimmed)) + { + pendingLines.Add(line); + } + else if (pendingLines.Count > 0 && string.IsNullOrWhiteSpace(trimmed)) + { + pendingLines.Add(line); + } + else + { + pendingLines.Clear(); + } + + continue; + } + + currentDeclaration.Add(line); + braceDepth += CountBraceDelta(line, ref inBlockComment); + + if (braceDepth == 0) + { + declarations.Add( + $"{currentTypeName}.java", + CreateJavaSourceFile($"{currentTypeName}.java", packageLine, importLines, currentDeclaration)); + + currentDeclaration = null; + currentTypeName = null; + pendingLines = []; + } + } + + return declarations; + } + + private static bool TryGetTopLevelDeclarationName(string trimmedLine, out string? declarationName) + { + declarationName = null; + + if (string.IsNullOrWhiteSpace(trimmedLine)) + { + return false; + } + + if (ShouldPreserveTopLevelLine(trimmedLine) || trimmedLine.StartsWith("//", StringComparison.Ordinal)) + { + return false; + } + + var declarationLine = trimmedLine; + while (true) + { + var updated = declarationLine switch + { + _ when declarationLine.StartsWith("public ", StringComparison.Ordinal) => declarationLine["public ".Length..].TrimStart(), + _ when declarationLine.StartsWith("final ", StringComparison.Ordinal) => declarationLine["final ".Length..].TrimStart(), + _ when declarationLine.StartsWith("abstract ", StringComparison.Ordinal) => declarationLine["abstract ".Length..].TrimStart(), + _ when declarationLine.StartsWith("static ", StringComparison.Ordinal) => declarationLine["static ".Length..].TrimStart(), + _ => declarationLine + }; + + if (ReferenceEquals(updated, declarationLine) || updated == declarationLine) + { + break; + } + + declarationLine = updated; + } + + foreach (var kind in new[] { "class", "interface", "enum", "record" }) + { + var kindPrefix = kind + " "; + if (!declarationLine.StartsWith(kindPrefix, StringComparison.Ordinal)) + { + continue; + } + + declarationName = declarationLine[kindPrefix.Length..] + .Split([' ', '\t', '<'], StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries)[0]; + return true; + } + + return false; + } + + private static bool ShouldPreserveTopLevelLine(string trimmedLine) => + trimmedLine.StartsWith("/**", StringComparison.Ordinal) + || trimmedLine.StartsWith("/*", StringComparison.Ordinal) + || trimmedLine.StartsWith("*", StringComparison.Ordinal) + || trimmedLine.StartsWith("*/", StringComparison.Ordinal) + || trimmedLine.StartsWith("@", StringComparison.Ordinal); + + private static string PromoteTopLevelDeclaration(string line) + { + var trimmed = line.TrimStart(); + if (trimmed.StartsWith("public ", StringComparison.Ordinal)) + { + return line; + } + + var leadingWhitespaceLength = line.Length - trimmed.Length; + var leadingWhitespace = line[..leadingWhitespaceLength]; + + foreach (var declarationPrefix in new[] + { + "final class ", + "abstract class ", + "static class ", + "class ", + "interface ", + "enum ", + "record " + }) + { + if (trimmed.StartsWith(declarationPrefix, StringComparison.Ordinal)) + { + return $"{leadingWhitespace}public {trimmed}"; + } + } + + return line; + } + + private static int CountBraceDelta(string line, ref bool inBlockComment) + { + var delta = 0; + var inString = false; + var inChar = false; + var escaped = false; + + for (var i = 0; i < line.Length; i++) + { + var ch = line[i]; + var next = i + 1 < line.Length ? line[i + 1] : '\0'; + + if (inBlockComment) + { + if (ch == '*' && next == '/') + { + inBlockComment = false; + i++; + } + continue; + } + + if (!inString && !inChar) + { + if (ch == '/' && next == '/') + { + break; + } + + if (ch == '/' && next == '*') + { + inBlockComment = true; + i++; + continue; + } + } + + if (escaped) + { + escaped = false; + continue; + } + + if (inString) + { + if (ch == '\\') + { + escaped = true; + } + else if (ch == '"') + { + inString = false; + } + + continue; + } + + if (inChar) + { + if (ch == '\\') + { + escaped = true; + } + else if (ch == '\'') + { + inChar = false; + } + + continue; + } + + if (ch == '"') + { + inString = true; + continue; + } + + if (ch == '\'') + { + inChar = true; + continue; + } + + if (ch == '{') + { + delta++; + } + else if (ch == '}') + { + delta--; + } + } + + return delta; + } + + private static string CreateJavaSourceFile(string fileName, string packageLine, List importLines, List declarationLines) + { + var builder = new StringBuilder(); + builder.Append("// "); + builder.Append(fileName); + builder.AppendLine(" - GENERATED CODE - DO NOT EDIT"); + builder.AppendLine(); + builder.AppendLine(packageLine); + builder.AppendLine(); + + foreach (var importLine in importLines) + { + builder.AppendLine(importLine); + } + + if (importLines.Count > 0) + { + builder.AppendLine(); + } + + foreach (var line in declarationLines) + { + builder.AppendLine(line); + } + + return builder.ToString(); + } + private string GenerateAspireSdk(AtsContext context) { using var stringWriter = new StringWriter(CultureInfo.InvariantCulture); @@ -76,6 +408,10 @@ private string GenerateAspireSdk(AtsContext context) _dtoNames[dto.TypeId] = SanitizeIdentifier(dto.Name); } + _optionsClassesToGenerate.Clear(); + _capabilityOptionsClassMap.Clear(); + CollectOptionsClasses(capabilities); + var handleTypes = BuildHandleTypes(context); var capabilitiesByTarget = GroupCapabilitiesByTarget(capabilities); var collectionTypes = CollectListAndDictTypeIds(capabilities); @@ -83,6 +419,7 @@ private string GenerateAspireSdk(AtsContext context) WriteHeader(); GenerateEnumTypes(enumTypes); GenerateDtoTypes(dtoTypes); + GenerateOptionTypes(); GenerateHandleTypes(handleTypes, capabilitiesByTarget); GenerateHandleWrapperRegistrations(handleTypes, collectionTypes); GenerateConnectionHelpers(); @@ -129,7 +466,7 @@ private void GenerateEnumTypes(IReadOnlyList enumTypes) var enumName = _enumNames[enumType.TypeId]; WriteLine($"/** {enumType.Name} enum. */"); - WriteLine($"enum {enumName} {{"); + WriteLine($"enum {enumName} implements WireValueEnum {{"); var members = Enum.GetNames(enumType.ClrType); for (var i = 0; i < members.Length; i++) { @@ -208,17 +545,309 @@ private void GenerateDtoTypes(IReadOnlyList dtoTypes) WriteLine(" Map map = new HashMap<>();"); foreach (var property in dto.Properties) { - var fieldName = ToCamelCase(property.Name); - WriteLine($" map.put(\"{property.Name}\", AspireClient.serializeValue({fieldName}));"); + var fieldName = ToCamelCase(property.Name); + WriteLine($" map.put(\"{property.Name}\", AspireClient.serializeValue({fieldName}));"); + } + WriteLine(" return map;"); + WriteLine(" }"); + + WriteLine("}"); + WriteLine(); + } + } + + private void CollectOptionsClasses(IReadOnlyList capabilities) + { + foreach (var capability in capabilities) + { + var targetParamName = capability.TargetParameterName ?? "builder"; + var parameters = capability.Parameters + .Where(p => !string.Equals(p.Name, targetParamName, StringComparison.Ordinal)) + .ToList(); + var (_, optionalParameters) = SeparateParameters(parameters); + if (optionalParameters.Count > 1) + { + RegisterOptionsClass(capability.CapabilityId, capability.MethodName, optionalParameters); + } + } + } + + private void RegisterOptionsClass(string capabilityId, string methodName, List optionalParameters) + { + var baseClassName = GetOptionsClassName(methodName); + if (_optionsClassesToGenerate.TryGetValue(baseClassName, out var existingParameters)) + { + if (AreOptionsCompatible(existingParameters, optionalParameters)) + { + _capabilityOptionsClassMap[capabilityId] = baseClassName; + return; + } + + for (var suffix = 1; ; suffix++) + { + var suffixedName = GetOptionsClassName($"{methodName}{suffix}"); + if (!_optionsClassesToGenerate.TryGetValue(suffixedName, out var suffixedParameters)) + { + _optionsClassesToGenerate[suffixedName] = [.. optionalParameters]; + _capabilityOptionsClassMap[capabilityId] = suffixedName; + return; + } + + if (AreOptionsCompatible(suffixedParameters, optionalParameters)) + { + _capabilityOptionsClassMap[capabilityId] = suffixedName; + return; + } + } + } + + _optionsClassesToGenerate[baseClassName] = [.. optionalParameters]; + _capabilityOptionsClassMap[capabilityId] = baseClassName; + } + + private static bool AreOptionsCompatible(List existing, List candidate) + { + if (existing.Count != candidate.Count) + { + return false; + } + + for (var i = 0; i < existing.Count; i++) + { + if (!AreParameterTypesEqual(existing[i], candidate[i]) || !string.Equals(existing[i].Name, candidate[i].Name, StringComparison.Ordinal)) + { + return false; + } + } + + return true; + } + + private static bool AreParameterTypesEqual(AtsParameterInfo left, AtsParameterInfo right) + { + if (!string.Equals(left.Type?.TypeId, right.Type?.TypeId, StringComparison.Ordinal)) + { + return false; + } + + if (left.IsCallback != right.IsCallback) + { + return false; + } + + if (!left.IsCallback) + { + return true; + } + + var leftCallbackParameters = left.CallbackParameters ?? []; + var rightCallbackParameters = right.CallbackParameters ?? []; + if (leftCallbackParameters.Count != rightCallbackParameters.Count) + { + return false; + } + + for (var i = 0; i < leftCallbackParameters.Count; i++) + { + if (!string.Equals(leftCallbackParameters[i].Type.TypeId, rightCallbackParameters[i].Type.TypeId, StringComparison.Ordinal)) + { + return false; + } + } + + return string.Equals(left.CallbackReturnType?.TypeId, right.CallbackReturnType?.TypeId, StringComparison.Ordinal); + } + + private void GenerateOptionTypes() + { + if (_optionsClassesToGenerate.Count == 0) + { + return; + } + + WriteLine("// ============================================================================"); + WriteLine("// Options Types"); + WriteLine("// ============================================================================"); + WriteLine(); + + foreach (var (className, optionalParameters) in _optionsClassesToGenerate.OrderBy(kvp => kvp.Key, StringComparer.Ordinal)) + { + WriteLine($"/** Options for {className[..^"Options".Length]}. */"); + WriteLine($"final class {className} {{"); + foreach (var parameter in optionalParameters) + { + var parameterName = ToCamelCase(parameter.Name); + WriteLine($" private {MapParameterToJava(parameter)} {parameterName};"); + } + WriteLine(); + + foreach (var parameter in optionalParameters) + { + var parameterName = ToCamelCase(parameter.Name); + var parameterType = MapParameterToJava(parameter); + WriteLine($" public {parameterType} {GetOptionGetterName(parameter)}() {{ return {parameterName}; }}"); + WriteLine($" public {className} {parameterName}({parameterType} value) {{"); + WriteLine($" this.{parameterName} = value;"); + WriteLine(" return this;"); + WriteLine(" }"); + WriteLine(); + } + + WriteLine("}"); + WriteLine(); + } + } + + private static (List Required, List Optional) SeparateParameters(IEnumerable parameters) + { + var required = new List(); + var optional = new List(); + + foreach (var parameter in parameters) + { + if (parameter.IsOptional || parameter.IsNullable) + { + optional.Add(parameter); + } + else + { + required.Add(parameter); + } + } + + return (required, optional); + } + + private string? ResolveOptionsClassName(AtsCapabilityInfo capability) => + _capabilityOptionsClassMap.TryGetValue(capability.CapabilityId, out var className) ? className : null; + + private static string GetOptionsClassName(string methodName) => + SanitizeIdentifier($"{ToPascalCase(methodName)}Options"); + + private static string AppendArgumentList(IEnumerable arguments, string trailingArgument) + { + var argumentList = arguments.ToList(); + argumentList.Add(trailingArgument); + return string.Join(", ", argumentList); + } + + private List CreateMethodParameters(IEnumerable parameters) + { + var result = new List(); + + foreach (var parameter in parameters) + { + var (resourceWrapperType, resourceWrapperParameterType) = GetResourceBuilderWrapperType(parameter); + result.Add(new JavaMethodParameter( + MapParameterToJava(parameter), + ToCamelCase(parameter.Name), + resourceWrapperType, + resourceWrapperParameterType)); + } + + return result; + } + + private (string? ResourceWrapperType, string? ResourceWrapperParameterType) GetResourceBuilderWrapperType(AtsParameterInfo parameter) + { + if (parameter.IsCallback || parameter.Type?.Category != AtsTypeCategory.Handle) + { + return (null, null); + } + + var wrapperType = MapInputTypeToJava(parameter.Type, parameter.IsOptional || parameter.IsNullable); + if (!wrapperType.StartsWith("I", StringComparison.Ordinal)) + { + return (null, null); + } + + return _resourceBuilderHandleClasses.Contains(wrapperType) + ? (wrapperType, "ResourceBuilderBase") + : (wrapperType, "HandleWrapperBase"); + } + + private void GenerateResourceBuilderOverloads( + string returnType, + string methodName, + IReadOnlyList parameters, + bool hasReturn) + { + if (parameters.Count == 0) + { + return; + } + + var convertibleParameters = parameters + .Select((parameter, index) => new { Parameter = parameter, Index = index }) + .Where(x => x.Parameter.ResourceWrapperType is not null) + .ToList(); + + if (convertibleParameters.Count == 0) + { + return; + } + + var seenSignatures = new HashSet(StringComparer.Ordinal); + var combinationCount = 1 << convertibleParameters.Count; + + for (var mask = 1; mask < combinationCount; mask++) + { + var selectedIndexes = new HashSet( + convertibleParameters + .Where((_, bitIndex) => (mask & (1 << bitIndex)) != 0) + .Select(x => x.Index)); + + var overloadParameters = new List(parameters.Count); + var callArguments = new List(parameters.Count); + + for (var i = 0; i < parameters.Count; i++) + { + var parameter = parameters[i]; + if (selectedIndexes.Contains(i)) + { + overloadParameters.Add($"{parameter.ResourceWrapperParameterType} {parameter.Name}"); + callArguments.Add($"new {parameter.ResourceWrapperType}({parameter.Name}.getHandle(), {parameter.Name}.getClient())"); + } + else + { + overloadParameters.Add($"{parameter.Type} {parameter.Name}"); + callArguments.Add(parameter.Name); + } + } + + var signature = string.Join(", ", overloadParameters); + if (!seenSignatures.Add(signature)) + { + continue; + } + + WriteLine($" public {returnType} {methodName}({signature}) {{"); + if (hasReturn) + { + WriteLine($" return {methodName}({string.Join(", ", callArguments)});"); + } + else + { + WriteLine($" {methodName}({string.Join(", ", callArguments)});"); } - WriteLine(" return map;"); WriteLine(" }"); - - WriteLine("}"); WriteLine(); } } + private static string GetOptionGetterName(AtsParameterInfo parameter) + { + var parameterName = ToCamelCase(parameter.Name); + if (parameterName.StartsWith("is", StringComparison.Ordinal) && + parameterName.Length > 2 && + char.IsUpper(parameterName[2])) + { + return parameterName; + } + + return $"get{ToPascalCase(parameterName)}"; + } + private void GenerateHandleTypes( IReadOnlyList handleTypes, Dictionary> capabilitiesByTarget) @@ -247,34 +876,327 @@ private void GenerateHandleTypes( { foreach (var method in methods) { - GenerateCapabilityMethod(method); + GenerateCapabilityMethod(handleType, method); } } + if (string.Equals(handleType.ClassName, "DistributedApplication", StringComparison.Ordinal)) + { + GenerateDistributedApplicationBuilderHelpers(); + } + WriteLine("}"); WriteLine(); } } - private void GenerateCapabilityMethod(AtsCapabilityInfo capability) + private void GenerateDistributedApplicationBuilderHelpers() + { + var builderClassName = _classNames.TryGetValue(AtsConstants.BuilderTypeId, out var name) + ? name + : "DistributedApplicationBuilder"; + + WriteLine(" /** Create a new distributed application builder. */"); + WriteLine($" public static {builderClassName} CreateBuilder() throws Exception {{"); + WriteLine(" return CreateBuilder((String[]) null);"); + WriteLine(" }"); + WriteLine(); + WriteLine(" /** Create a new distributed application builder. */"); + WriteLine($" public static {builderClassName} CreateBuilder(String[] args) throws Exception {{"); + WriteLine(" CreateBuilderOptions options = new CreateBuilderOptions();"); + WriteLine(" if (args != null) {"); + WriteLine(" options.setArgs(args);"); + WriteLine(" }"); + WriteLine(" return CreateBuilder(options);"); + WriteLine(" }"); + WriteLine(); + WriteLine(" /** Create a new distributed application builder. */"); + WriteLine($" public static {builderClassName} CreateBuilder(CreateBuilderOptions options) throws Exception {{"); + WriteLine(" return Aspire.createBuilder(options);"); + WriteLine(" }"); + WriteLine(); + } + + private void GenerateCapabilityMethod(JavaHandleType handleType, AtsCapabilityInfo capability) { var targetParamName = capability.TargetParameterName ?? "builder"; var methodName = ToCamelCase(capability.MethodName); var parameters = capability.Parameters .Where(p => !string.Equals(p.Name, targetParamName, StringComparison.Ordinal)) .ToList(); + var (requiredParameters, optionalParameters) = SeparateParameters(parameters); + var optionsClassName = ResolveOptionsClassName(capability); + var useOptionsClass = optionsClassName is not null; + var returnInfo = GetMethodReturnInfo(handleType, capability); - // Check if this is a List/Dict property getter (no parameters, returns List/Dict) if (parameters.Count == 0 && IsListOrDictPropertyGetter(capability.ReturnType)) { GenerateListOrDictProperty(capability, methodName); return; } - var returnType = MapTypeRefToJava(capability.ReturnType, false); - var hasReturn = capability.ReturnType.TypeId != AtsConstants.Void; + if (useOptionsClass) + { + var implementationMethodName = $"{methodName}Impl"; + GenerateUnionOverloadsWithOptions(returnInfo, methodName, requiredParameters, optionsClassName!); + GenerateOptionsOverloads(capability, returnInfo, methodName, implementationMethodName, requiredParameters, optionalParameters, optionsClassName!); + GenerateCapabilityMethodImplementation(capability, returnInfo, implementationMethodName, targetParamName, parameters, isPublic: false); + } + else + { + GenerateUnionOverloads(returnInfo, methodName, parameters); + GenerateOptionalOverloads(returnInfo, methodName, parameters); + GenerateCapabilityMethodImplementation(capability, returnInfo, methodName, targetParamName, parameters, isPublic: true); + } + } + + private void GenerateUnionOverloads(JavaCapabilityReturnInfo returnInfo, string methodName, List parameters) + { + var unionParameters = parameters.Where(p => IsUnionType(p.Type)).ToList(); + if (unionParameters.Count != 1) + { + return; + } + + var unionParameter = unionParameters[0]; + var unionTypes = unionParameter.Type?.UnionTypes; + if (unionTypes is null || unionTypes.Count == 0) + { + return; + } + + var unionParamName = ToCamelCase(unionParameter.Name); + + foreach (var unionType in unionTypes + .Select(type => new { Type = type, JavaType = MapInputTypeToJava(type, unionParameter.IsOptional || unionParameter.IsNullable) }) + .DistinctBy(x => x.JavaType, StringComparer.Ordinal) + .Select(x => x.Type)) + { + var overloadParameters = new StringBuilder(); + foreach (var parameter in parameters) + { + if (overloadParameters.Length > 0) + { + overloadParameters.Append(", "); + } + + var parameterType = ReferenceEquals(parameter, unionParameter) + ? MapInputTypeToJava(unionType, unionParameter.IsOptional || unionParameter.IsNullable) + : MapParameterToJava(parameter); + overloadParameters.Append(CultureInfo.InvariantCulture, $"{parameterType} {ToCamelCase(parameter.Name)}"); + } + + WriteLine($" public {returnInfo.ReturnType} {methodName}({overloadParameters}) {{"); + var callArguments = string.Join(", ", parameters.Select(parameter => + ReferenceEquals(parameter, unionParameter) + ? $"AspireUnion.of({unionParamName})" + : ToCamelCase(parameter.Name))); + if (returnInfo.HasReturn) + { + WriteLine($" return {methodName}({callArguments});"); + } + else + { + WriteLine($" {methodName}({callArguments});"); + } + WriteLine(" }"); + WriteLine(); + } + } + + private void GenerateOptionalOverloads(JavaCapabilityReturnInfo returnInfo, string methodName, List parameters) + { + var trailingOptionalCount = parameters.AsEnumerable().Reverse().TakeWhile(IsOmittableParameter).Count(); + if (trailingOptionalCount == 0) + { + return; + } + + for (var omitCount = trailingOptionalCount; omitCount >= 1; omitCount--) + { + var visibleParameters = parameters.Take(parameters.Count - omitCount).ToList(); + var parameterList = string.Join(", ", visibleParameters.Select(parameter => $"{MapParameterToJava(parameter)} {ToCamelCase(parameter.Name)}")); + WriteLine($" public {returnInfo.ReturnType} {methodName}({parameterList}) {{"); + + var callArguments = new List(parameters.Count); + foreach (var parameter in parameters) + { + if (visibleParameters.Contains(parameter)) + { + callArguments.Add(ToCamelCase(parameter.Name)); + } + else + { + callArguments.Add("null"); + } + } + + if (returnInfo.HasReturn) + { + WriteLine($" return {methodName}({string.Join(", ", callArguments)});"); + } + else + { + WriteLine($" {methodName}({string.Join(", ", callArguments)});"); + } + WriteLine(" }"); + WriteLine(); + + GenerateResourceBuilderOverloads( + returnInfo.ReturnType, + methodName, + CreateMethodParameters(visibleParameters), + returnInfo.HasReturn); + } + } + + private void GenerateUnionOverloadsWithOptions( + JavaCapabilityReturnInfo returnInfo, + string methodName, + List requiredParameters, + string optionsClassName) + { + var unionParameters = requiredParameters.Where(p => IsUnionType(p.Type)).ToList(); + if (unionParameters.Count != 1) + { + return; + } + + var unionParameter = unionParameters[0]; + var unionTypes = unionParameter.Type?.UnionTypes; + if (unionTypes is null || unionTypes.Count == 0) + { + return; + } + + var unionParamName = ToCamelCase(unionParameter.Name); + + foreach (var unionType in unionTypes + .Select(type => new { Type = type, JavaType = MapInputTypeToJava(type, unionParameter.IsOptional || unionParameter.IsNullable) }) + .DistinctBy(x => x.JavaType, StringComparer.Ordinal) + .Select(x => x.Type)) + { + var overloadParameters = new StringBuilder(); + foreach (var parameter in requiredParameters) + { + if (overloadParameters.Length > 0) + { + overloadParameters.Append(", "); + } + + var parameterType = ReferenceEquals(parameter, unionParameter) + ? MapInputTypeToJava(unionType, unionParameter.IsOptional || unionParameter.IsNullable) + : MapParameterToJava(parameter); + overloadParameters.Append(CultureInfo.InvariantCulture, $"{parameterType} {ToCamelCase(parameter.Name)}"); + } + + if (overloadParameters.Length > 0) + { + overloadParameters.Append(", "); + } + overloadParameters.Append(CultureInfo.InvariantCulture, $"{optionsClassName} options"); + + WriteLine($" public {returnInfo.ReturnType} {methodName}({overloadParameters}) {{"); + var callArguments = string.Join(", ", requiredParameters.Select(parameter => + ReferenceEquals(parameter, unionParameter) + ? $"AspireUnion.of({unionParamName})" + : ToCamelCase(parameter.Name))); + if (returnInfo.HasReturn) + { + WriteLine($" return {methodName}({callArguments}, options);"); + } + else + { + WriteLine($" {methodName}({callArguments}, options);"); + } + WriteLine(" }"); + WriteLine(); + + WriteLine($" public {returnInfo.ReturnType} {methodName}({string.Join(", ", requiredParameters.Select(parameter => ReferenceEquals(parameter, unionParameter) ? $"{MapInputTypeToJava(unionType, unionParameter.IsOptional || unionParameter.IsNullable)} {ToCamelCase(parameter.Name)}" : $"{MapParameterToJava(parameter)} {ToCamelCase(parameter.Name)}"))}) {{"); + if (returnInfo.HasReturn) + { + WriteLine($" return {methodName}({callArguments});"); + } + else + { + WriteLine($" {methodName}({callArguments});"); + } + WriteLine(" }"); + WriteLine(); + } + } + + private void GenerateOptionsOverloads( + AtsCapabilityInfo capability, + JavaCapabilityReturnInfo returnInfo, + string methodName, + string implementationMethodName, + List requiredParameters, + List optionalParameters, + string optionsClassName) + { + var requiredParameterList = string.Join(", ", requiredParameters.Select(parameter => $"{MapParameterToJava(parameter)} {ToCamelCase(parameter.Name)}")); + var publicParameterList = string.IsNullOrEmpty(requiredParameterList) + ? $"{optionsClassName} options" + : $"{requiredParameterList}, {optionsClassName} options"; + + if (!string.IsNullOrEmpty(capability.Description)) + { + WriteLine($" /** {capability.Description} */"); + } + + WriteLine($" public {returnInfo.ReturnType} {methodName}({publicParameterList}) {{"); + foreach (var parameter in optionalParameters) + { + var paramName = ToCamelCase(parameter.Name); + WriteLine($" var {paramName} = options == null ? null : options.{GetOptionGetterName(parameter)}();"); + } + + var implementationArguments = requiredParameters + .Select(parameter => ToCamelCase(parameter.Name)) + .Concat(optionalParameters.Select(parameter => ToCamelCase(parameter.Name))) + .ToList(); + + if (returnInfo.HasReturn) + { + WriteLine($" return {implementationMethodName}({string.Join(", ", implementationArguments)});"); + } + else + { + WriteLine($" {implementationMethodName}({string.Join(", ", implementationArguments)});"); + } + WriteLine(" }"); + WriteLine(); + + var optionsParameters = CreateMethodParameters(requiredParameters); + optionsParameters.Add(new JavaMethodParameter(optionsClassName, "options")); + GenerateResourceBuilderOverloads( + returnInfo.ReturnType, + methodName, + optionsParameters, + returnInfo.HasReturn); + + WriteLine($" public {returnInfo.ReturnType} {methodName}({requiredParameterList}) {{"); + if (returnInfo.HasReturn) + { + WriteLine($" return {methodName}({AppendArgumentList(requiredParameters.Select(parameter => ToCamelCase(parameter.Name)), "null")});"); + } + else + { + WriteLine($" {methodName}({AppendArgumentList(requiredParameters.Select(parameter => ToCamelCase(parameter.Name)), "null")});"); + } + WriteLine(" }"); + WriteLine(); + + GenerateResourceBuilderOverloads( + returnInfo.ReturnType, + methodName, + CreateMethodParameters(requiredParameters), + returnInfo.HasReturn); + } - // Build parameter list + private void GenerateCapabilityMethodImplementation(AtsCapabilityInfo capability, JavaCapabilityReturnInfo returnInfo, string methodName, string targetParamName, List parameters, bool isPublic) + { var paramList = new StringBuilder(); foreach (var parameter in parameters) { @@ -282,22 +1204,16 @@ private void GenerateCapabilityMethod(AtsCapabilityInfo capability) { paramList.Append(", "); } - var paramName = ToCamelCase(parameter.Name); - var paramType = parameter.IsCallback - ? "Function" - : IsCancellationToken(parameter) - ? "CancellationToken" - : MapTypeRefToJava(parameter.Type, parameter.IsOptional); - paramList.Append(CultureInfo.InvariantCulture, $"{paramType} {paramName}"); + paramList.Append(CultureInfo.InvariantCulture, $"{MapParameterToJava(parameter)} {ToCamelCase(parameter.Name)}"); } - // Generate Javadoc if (!string.IsNullOrEmpty(capability.Description)) { WriteLine($" /** {capability.Description} */"); } - WriteLine($" public {returnType} {methodName}({paramList}) {{"); + var accessibility = isPublic ? "public" : "private"; + WriteLine($" {accessibility} {returnInfo.ReturnType} {methodName}({paramList}) {{"); WriteLine(" Map reqArgs = new HashMap<>();"); WriteLine($" reqArgs.put(\"{targetParamName}\", AspireClient.serializeValue(getHandle()));"); @@ -306,8 +1222,9 @@ private void GenerateCapabilityMethod(AtsCapabilityInfo capability) var paramName = ToCamelCase(parameter.Name); if (parameter.IsCallback) { - WriteLine($" if ({paramName} != null) {{"); - WriteLine($" reqArgs.put(\"{parameter.Name}\", getClient().registerCallback({paramName}));"); + GenerateCallbackRegistration(parameter); + WriteLine($" if ({paramName}Id != null) {{"); + WriteLine($" reqArgs.put(\"{parameter.Name}\", {paramName}Id);"); WriteLine(" }"); continue; } @@ -320,7 +1237,7 @@ private void GenerateCapabilityMethod(AtsCapabilityInfo capability) continue; } - if (parameter.IsOptional) + if (IsOmittableParameter(parameter)) { WriteLine($" if ({paramName} != null) {{"); WriteLine($" reqArgs.put(\"{parameter.Name}\", AspireClient.serializeValue({paramName}));"); @@ -332,9 +1249,21 @@ private void GenerateCapabilityMethod(AtsCapabilityInfo capability) } } - if (hasReturn) + if (returnInfo.ReturnsCurrentBuilder) { - WriteLine($" return ({returnType}) getClient().invokeCapability(\"{capability.CapabilityId}\", reqArgs);"); + WriteLine($" getClient().invokeCapability(\"{capability.CapabilityId}\", reqArgs);"); + WriteLine(" return this;"); + } + else if (returnInfo.HasReturn) + { + if (IsUnionType(capability.ReturnType)) + { + WriteLine($" return AspireUnion.of(getClient().invokeCapability(\"{capability.CapabilityId}\", reqArgs));"); + } + else + { + WriteLine($" return ({returnInfo.ReturnType}) getClient().invokeCapability(\"{capability.CapabilityId}\", reqArgs);"); + } } else { @@ -343,8 +1272,139 @@ private void GenerateCapabilityMethod(AtsCapabilityInfo capability) WriteLine(" }"); WriteLine(); + + if (isPublic) + { + GenerateResourceBuilderOverloads( + returnInfo.ReturnType, + methodName, + CreateMethodParameters(parameters), + returnInfo.HasReturn); + } + } + + private JavaCapabilityReturnInfo GetMethodReturnInfo(JavaHandleType handleType, AtsCapabilityInfo capability) + { + if (capability.ReturnsBuilder) + { + var returnsDifferentBuilder = capability.ReturnType?.TypeId is { } returnTypeId && + !string.Equals(returnTypeId, handleType.TypeId, StringComparison.Ordinal) && + !string.Equals(returnTypeId, capability.TargetTypeId, StringComparison.Ordinal); + + return returnsDifferentBuilder + ? new(MapHandleType(capability.ReturnType!.TypeId!), HasReturn: true, ReturnsCurrentBuilder: false) + : new(handleType.ClassName, HasReturn: true, ReturnsCurrentBuilder: true); + } + + var hasReturn = capability.ReturnType?.TypeId != AtsConstants.Void; + return new(hasReturn ? MapTypeRefToJava(capability.ReturnType, false) : "void", hasReturn, ReturnsCurrentBuilder: false); + } + + private string GenerateCallbackTypeSignature(IReadOnlyList? callbackParameters, AtsTypeRef? callbackReturnType) + { + var parameterCount = callbackParameters?.Count ?? 0; + if (parameterCount > 4) + { + return "Function"; + } + + var hasReturnType = callbackReturnType != null && callbackReturnType.TypeId != AtsConstants.Void; + var baseType = hasReturnType ? $"AspireFunc{parameterCount}" : $"AspireAction{parameterCount}"; + if (parameterCount == 0 && !hasReturnType) + { + return baseType; + } + + var typeArguments = new List(); + if (callbackParameters is not null) + { + typeArguments.AddRange(callbackParameters.Select(parameter => MapCallbackTypeToJava(parameter.Type))); + } + if (hasReturnType) + { + typeArguments.Add(MapCallbackTypeToJava(callbackReturnType)); + } + + return $"{baseType}<{string.Join(", ", typeArguments)}>"; } + private void GenerateCallbackRegistration(AtsParameterInfo callbackParam) + { + var callbackName = ToCamelCase(callbackParam.Name); + var callbackParameters = callbackParam.CallbackParameters; + var isOptional = callbackParam.IsOptional || callbackParam.IsNullable; + var callbackInitializer = isOptional ? $"{callbackName} == null ? null : " : string.Empty; + + WriteLine($" var {callbackName}Id = {callbackInitializer}getClient().registerCallback(args -> {{"); + GenerateCallbackBody(callbackName, callbackParam, callbackParameters); + WriteLine(" });"); + } + + private void GenerateCallbackBody(string callbackName, AtsParameterInfo callbackParam, IReadOnlyList? callbackParameters) + { + var hasReturnType = callbackParam.CallbackReturnType != null && callbackParam.CallbackReturnType.TypeId != AtsConstants.Void; + var callArguments = new List(); + + if (callbackParameters is not null) + { + for (var i = 0; i < callbackParameters.Count; i++) + { + var callbackParameter = callbackParameters[i]; + var callbackParameterName = ToCamelCase(callbackParameter.Name); + WriteLine($" var {callbackParameterName} = {GetCallbackArgumentExpression(callbackParameter, i)};"); + callArguments.Add(callbackParameterName); + } + } + + var callbackInvocation = $"{callbackName}.invoke({string.Join(", ", callArguments)})"; + if (hasReturnType) + { + WriteLine($" return AspireClient.awaitValue({callbackInvocation});"); + } + else + { + WriteLine($" {callbackInvocation};"); + WriteLine(" return null;"); + } + } + + private string GetCallbackArgumentExpression(AtsCallbackParameterInfo callbackParameter, int index) + { + if (callbackParameter.Type?.TypeId == AtsConstants.CancellationToken) + { + return $"CancellationToken.fromValue(args[{index}])"; + } + + if (IsUnionType(callbackParameter.Type)) + { + return $"AspireUnion.of(args[{index}])"; + } + + return $"({MapCallbackTypeToJava(callbackParameter.Type)}) args[{index}]"; + } + + private string MapCallbackTypeToJava(AtsTypeRef? typeRef) + { + if (typeRef is null) + { + return "Object"; + } + + if (typeRef.TypeId == AtsConstants.CancellationToken) + { + return "CancellationToken"; + } + + if (IsUnionType(typeRef)) + { + return "AspireUnion"; + } + + return MapTypeRefToJava(typeRef, true, useBoxedTypes: true); + } + + private static bool IsOmittableParameter(AtsParameterInfo parameter) => parameter.IsOptional || parameter.IsNullable; + private static bool IsListOrDictPropertyGetter(AtsTypeRef? returnType) { if (returnType is null) @@ -462,6 +1522,7 @@ private void GenerateConnectionHelpers() WriteLine("public class Aspire {"); WriteLine(" /** Connect to the AppHost server. */"); WriteLine(" public static AspireClient connect() throws Exception {"); + WriteLine(" BaseRegistrations.ensureRegistered();"); WriteLine(" AspireRegistrations.ensureRegistered();"); WriteLine(" String socketPath = System.getenv(\"REMOTE_APP_HOST_SOCKET_PATH\");"); WriteLine(" if (socketPath == null || socketPath.isEmpty()) {"); @@ -480,13 +1541,19 @@ private void GenerateConnectionHelpers() WriteLine(" if (options != null) {"); WriteLine(" resolvedOptions.putAll(options.toMap());"); WriteLine(" }"); - WriteLine(" if (!resolvedOptions.containsKey(\"Args\")) {"); + WriteLine(" if (resolvedOptions.get(\"Args\") == null) {"); WriteLine(" // Note: Java doesn't have easy access to command line args from here"); WriteLine(" resolvedOptions.put(\"Args\", new String[0]);"); WriteLine(" }"); - WriteLine(" if (!resolvedOptions.containsKey(\"ProjectDirectory\")) {"); + WriteLine(" if (resolvedOptions.get(\"ProjectDirectory\") == null) {"); WriteLine(" resolvedOptions.put(\"ProjectDirectory\", System.getProperty(\"user.dir\"));"); WriteLine(" }"); + WriteLine(" if (resolvedOptions.get(\"AppHostFilePath\") == null) {"); + WriteLine(" String appHostFilePath = System.getenv(\"ASPIRE_APPHOST_FILEPATH\");"); + WriteLine(" if (appHostFilePath != null && !appHostFilePath.isEmpty()) {"); + WriteLine(" resolvedOptions.put(\"AppHostFilePath\", appHostFilePath);"); + WriteLine(" }"); + WriteLine(" }"); WriteLine(" Map args = new HashMap<>();"); WriteLine(" args.put(\"options\", resolvedOptions);"); WriteLine($" return ({builderClassName}) client.invokeCapability(\"Aspire.Hosting/createBuilderWithOptions\", args);"); @@ -532,6 +1599,7 @@ private IReadOnlyList BuildHandleTypes(AtsContext context) } _classNames.Clear(); + _resourceBuilderHandleClasses.Clear(); foreach (var typeId in handleTypeIds) { _classNames[typeId] = CreateClassName(typeId); @@ -547,7 +1615,12 @@ private IReadOnlyList BuildHandleTypes(AtsContext context) isResourceBuilder = typeInfo.IsResourceBuilder; } - results.Add(new JavaHandleType(typeId, _classNames[typeId], isResourceBuilder)); + var className = _classNames[typeId]; + results.Add(new JavaHandleType(typeId, className, isResourceBuilder)); + if (isResourceBuilder) + { + _resourceBuilderHandleClasses.Add(className); + } } return results; @@ -614,7 +1687,7 @@ private static Dictionary CollectListAndDictTypeIds(IReadOnlyList< return typeIds; } - private string MapTypeRefToJava(AtsTypeRef? typeRef, bool isOptional) + private string MapTypeRefToJava(AtsTypeRef? typeRef, bool isOptional, bool useBoxedTypes = false) { if (typeRef is null) { @@ -626,26 +1699,54 @@ private string MapTypeRefToJava(AtsTypeRef? typeRef, bool isOptional) return "ReferenceExpression"; } - var baseType = typeRef.Category switch + return typeRef.Category switch { - AtsTypeCategory.Primitive => MapPrimitiveType(typeRef.TypeId, isOptional), + AtsTypeCategory.Primitive => MapPrimitiveType(typeRef.TypeId, isOptional || useBoxedTypes), AtsTypeCategory.Enum => MapEnumType(typeRef.TypeId), AtsTypeCategory.Handle => MapHandleType(typeRef.TypeId), AtsTypeCategory.Dto => MapDtoType(typeRef.TypeId), - AtsTypeCategory.Callback => "Function", + AtsTypeCategory.Callback => "Object", AtsTypeCategory.Array => $"{MapTypeRefToJava(typeRef.ElementType, false)}[]", AtsTypeCategory.List => typeRef.IsReadOnly - ? $"List<{MapTypeRefToJava(typeRef.ElementType, false)}>" - : $"AspireList<{MapTypeRefToJava(typeRef.ElementType, false)}>", + ? $"List<{MapTypeRefToJava(typeRef.ElementType, false, useBoxedTypes: true)}>" + : $"AspireList<{MapTypeRefToJava(typeRef.ElementType, false, useBoxedTypes: true)}>", AtsTypeCategory.Dict => typeRef.IsReadOnly - ? $"Map<{MapTypeRefToJava(typeRef.KeyType, false)}, {MapTypeRefToJava(typeRef.ValueType, false)}>" - : $"AspireDict<{MapTypeRefToJava(typeRef.KeyType, false)}, {MapTypeRefToJava(typeRef.ValueType, false)}>", - AtsTypeCategory.Union => "Object", + ? $"Map<{MapTypeRefToJava(typeRef.KeyType, false, useBoxedTypes: true)}, {MapTypeRefToJava(typeRef.ValueType, false, useBoxedTypes: true)}>" + : $"AspireDict<{MapTypeRefToJava(typeRef.KeyType, false, useBoxedTypes: true)}, {MapTypeRefToJava(typeRef.ValueType, false, useBoxedTypes: true)}>", + AtsTypeCategory.Union => "AspireUnion", AtsTypeCategory.Unknown => "Object", _ => "Object" }; + } + + private string MapInputTypeToJava(AtsTypeRef? typeRef, bool isOptional = false) + { + if (typeRef is null) + { + return "Object"; + } + + if (IsCancellationTokenTypeId(typeRef.TypeId)) + { + return "CancellationToken"; + } + + if (IsUnionType(typeRef)) + { + return "AspireUnion"; + } + + return MapTypeRefToJava(typeRef, isOptional); + } + + private string MapParameterToJava(AtsParameterInfo parameter) + { + if (parameter.IsCallback) + { + return GenerateCallbackTypeSignature(parameter.CallbackParameters, parameter.CallbackReturnType); + } - return baseType; + return MapInputTypeToJava(parameter.Type, parameter.IsOptional || parameter.IsNullable); } private string MapHandleType(string typeId) => @@ -657,21 +1758,23 @@ private string MapDtoType(string typeId) => private string MapEnumType(string typeId) => _enumNames.TryGetValue(typeId, out var name) ? name : "String"; - private static string MapPrimitiveType(string typeId, bool isOptional) => typeId switch + private static string MapPrimitiveType(string typeId, bool useBoxedTypes) => typeId switch { AtsConstants.String or AtsConstants.Char => "String", - AtsConstants.Number => isOptional ? "Double" : "double", - AtsConstants.Boolean => isOptional ? "Boolean" : "boolean", + AtsConstants.Number => useBoxedTypes ? "Double" : "double", + AtsConstants.Boolean => useBoxedTypes ? "Boolean" : "boolean", AtsConstants.Void => "void", AtsConstants.Any => "Object", AtsConstants.DateTime or AtsConstants.DateTimeOffset or AtsConstants.DateOnly or AtsConstants.TimeOnly => "String", - AtsConstants.TimeSpan => isOptional ? "Double" : "double", + AtsConstants.TimeSpan => useBoxedTypes ? "Double" : "double", AtsConstants.Guid or AtsConstants.Uri => "String", AtsConstants.CancellationToken => "CancellationToken", _ => "Object" }; + private static bool IsUnionType(AtsTypeRef? typeRef) => typeRef?.Category == AtsTypeCategory.Union; + private static bool IsCancellationToken(AtsParameterInfo parameter) => IsCancellationTokenTypeId(parameter.Type?.TypeId); @@ -837,4 +1940,10 @@ private void WriteLine(string value = "") } private sealed record JavaHandleType(string TypeId, string ClassName, bool IsResourceBuilder); + private sealed record JavaMethodParameter( + string Type, + string Name, + string? ResourceWrapperType = null, + string? ResourceWrapperParameterType = null); + private sealed record JavaCapabilityReturnInfo(string ReturnType, bool HasReturn, bool ReturnsCurrentBuilder); } diff --git a/src/Aspire.Hosting.CodeGeneration.Java/JavaLanguageSupport.cs b/src/Aspire.Hosting.CodeGeneration.Java/JavaLanguageSupport.cs index d050f07fc46..e2b2da1a745 100644 --- a/src/Aspire.Hosting.CodeGeneration.Java/JavaLanguageSupport.cs +++ b/src/Aspire.Hosting.CodeGeneration.Java/JavaLanguageSupport.cs @@ -32,31 +32,20 @@ public Dictionary Scaffold(ScaffoldRequest request) { var files = new Dictionary(); - // Create AppHost.java - must be in same package as generated code (aspire) - // because Java only allows one public class per file files["AppHost.java"] = """ // Aspire Java AppHost // For more information, see: https://aspire.dev + + import aspire.*; - package aspire; + void main(String[] args) throws Exception { + var builder = DistributedApplication.CreateBuilder(args); - public class AppHost { - public static void main(String[] args) { - try { - IDistributedApplicationBuilder builder = Aspire.createBuilder(null); + // Add your resources here, for example: + // var redis = builder.addRedis("cache"); + // var postgres = builder.addPostgres("db"); - // Add your resources here, for example: - // var redis = builder.addRedis("cache"); - // var postgres = builder.addPostgres("db"); - - DistributedApplication app = builder.build(); - app.run(null); - } catch (Exception e) { - System.err.println("Failed to run: " + e.getMessage()); - e.printStackTrace(); - System.exit(1); - } - } + builder.build().run(); } """; @@ -116,8 +105,8 @@ public RuntimeSpec GetRuntimeSpec() // On Windows, use cmd /c; on Unix, use sh -c Command = OperatingSystem.IsWindows() ? "cmd" : "sh", Args = OperatingSystem.IsWindows() - ? ["/c", "javac -d . .modules\\Transport.java .modules\\Base.java .modules\\Aspire.java AppHost.java && java aspire.AppHost"] - : ["-c", "javac -d . .modules/Transport.java .modules/Base.java .modules/Aspire.java AppHost.java && java aspire.AppHost"] + ? ["/c", "if not exist .java-build mkdir .java-build && javac --enable-preview --source 25 -d .java-build @.modules\\sources.txt AppHost.java && java --enable-preview -cp .java-build AppHost {args}"] + : ["-c", "mkdir -p .java-build && javac --enable-preview --source 25 -d .java-build @.modules/sources.txt AppHost.java && java --enable-preview -cp .java-build AppHost {args}"] } }; } diff --git a/src/Aspire.Hosting.CodeGeneration.Java/Resources/Base.java b/src/Aspire.Hosting.CodeGeneration.Java/Resources/Base.java index 0d4a8d5c014..5ae113d8365 100644 --- a/src/Aspire.Hosting.CodeGeneration.Java/Resources/Base.java +++ b/src/Aspire.Hosting.CodeGeneration.Java/Resources/Base.java @@ -35,87 +35,224 @@ class ResourceBuilderBase extends HandleWrapperBase { } } +/** + * Marker interface for generated enums that need a transport value distinct from Enum.name(). + */ +interface WireValueEnum { + String getValue(); +} + +/** + * Represents a runtime union value for generated Java APIs. + */ +final class AspireUnion { + private final Object value; + + private AspireUnion(Object value) { + this.value = value; + } + + static AspireUnion of(Object value) { + return value instanceof AspireUnion union ? union : new AspireUnion(value); + } + + static AspireUnion fromValue(Object value) { + return of(value); + } + + Object getValue() { + return value; + } + + boolean is(Class type) { + return value != null && type.isInstance(value); + } + + T getValueAs(Class type) { + if (value == null) { + return null; + } + if (!type.isInstance(value)) { + throw new IllegalStateException("Union value is of type " + value.getClass().getName() + ", not " + type.getName()); + } + return type.cast(value); + } + + @Override + public String toString() { + return "AspireUnion{" + value + "}"; + } +} + +@FunctionalInterface +interface AspireAction0 { + void invoke(); +} + +@FunctionalInterface +interface AspireAction1 { + void invoke(T1 arg1); +} + +@FunctionalInterface +interface AspireAction2 { + void invoke(T1 arg1, T2 arg2); +} + +@FunctionalInterface +interface AspireAction3 { + void invoke(T1 arg1, T2 arg2, T3 arg3); +} + +@FunctionalInterface +interface AspireAction4 { + void invoke(T1 arg1, T2 arg2, T3 arg3, T4 arg4); +} + +@FunctionalInterface +interface AspireFunc0 { + R invoke(); +} + +@FunctionalInterface +interface AspireFunc1 { + R invoke(T1 arg1); +} + +@FunctionalInterface +interface AspireFunc2 { + R invoke(T1 arg1, T2 arg2); +} + +@FunctionalInterface +interface AspireFunc3 { + R invoke(T1 arg1, T2 arg2, T3 arg3); +} + +@FunctionalInterface +interface AspireFunc4 { + R invoke(T1 arg1, T2 arg2, T3 arg3, T4 arg4); +} + /** * ReferenceExpression represents a reference expression. - * Supports value mode (format + args) and conditional mode (condition + whenTrue + whenFalse). + * Supports value mode (format + value providers), conditional mode, and handle mode. */ class ReferenceExpression { - // Value mode fields private final String format; - private final Object[] args; - - // Conditional mode fields + private final Object[] valueProviders; private final Object condition; private final ReferenceExpression whenTrue; private final ReferenceExpression whenFalse; private final String matchValue; - private final boolean isConditional; + private final Handle handle; + private final AspireClient client; - // Value mode constructor - ReferenceExpression(String format, Object... args) { + ReferenceExpression(String format, Object... valueProviders) { this.format = format; - this.args = args; + this.valueProviders = valueProviders; this.condition = null; this.whenTrue = null; this.whenFalse = null; this.matchValue = null; - this.isConditional = false; + this.handle = null; + this.client = null; } - // Conditional mode constructor private ReferenceExpression(Object condition, String matchValue, ReferenceExpression whenTrue, ReferenceExpression whenFalse) { + this.format = null; + this.valueProviders = null; this.condition = condition; this.whenTrue = whenTrue; this.whenFalse = whenFalse; this.matchValue = matchValue != null ? matchValue : "True"; - this.isConditional = true; + this.handle = null; + this.client = null; + } + + ReferenceExpression(Handle handle, AspireClient client) { this.format = null; - this.args = null; + this.valueProviders = null; + this.condition = null; + this.whenTrue = null; + this.whenFalse = null; + this.matchValue = null; + this.handle = handle; + this.client = client; } - String getFormat() { - return format; + boolean isConditional() { + return condition != null; } - Object[] getArgs() { - return args; + boolean isHandle() { + return handle != null; } Map toJson() { - if (isConditional) { - var condPayload = new java.util.HashMap(); - condPayload.put("condition", AspireClient.serializeValue(condition)); - condPayload.put("whenTrue", whenTrue.toJson()); - condPayload.put("whenFalse", whenFalse.toJson()); - condPayload.put("matchValue", matchValue); - - var result = new java.util.HashMap(); - result.put("$refExpr", condPayload); - return result; + if (handle != null) { + return handle.toJson(); + } + + Map expression = new HashMap<>(); + if (isConditional()) { + expression.put("condition", extractValueProvider(condition)); + expression.put("whenTrue", whenTrue.toJson()); + expression.put("whenFalse", whenFalse.toJson()); + expression.put("matchValue", matchValue); + } else { + expression.put("format", format); + if (valueProviders != null && valueProviders.length > 0) { + List providers = new ArrayList<>(valueProviders.length); + for (Object valueProvider : valueProviders) { + providers.add(extractValueProvider(valueProvider)); + } + expression.put("valueProviders", providers); + } } - Map refExpr = new HashMap<>(); - refExpr.put("format", format); - refExpr.put("args", Arrays.asList(args)); - Map result = new HashMap<>(); - result.put("$refExpr", refExpr); + result.put("$expr", expression); return result; } - /** - * Creates a new reference expression. - */ - static ReferenceExpression refExpr(String format, Object... args) { - return new ReferenceExpression(format, args); + public String getValue() { + return getValue(null); } - /** - * Creates a conditional reference expression from its parts. - */ - static ReferenceExpression createConditional(Object condition, String matchValue, ReferenceExpression whenTrue, ReferenceExpression whenFalse) { + public String getValue(CancellationToken cancellationToken) { + if (handle == null || client == null) { + throw new IllegalStateException("getValue is only available on server-returned ReferenceExpression instances"); + } + + Map reqArgs = new HashMap<>(); + reqArgs.put("context", AspireClient.serializeValue(handle)); + if (cancellationToken != null) { + reqArgs.put("cancellationToken", client.registerCancellation(cancellationToken)); + } + + return (String) client.invokeCapability("Aspire.Hosting.ApplicationModel/getValue", reqArgs); + } + + public static ReferenceExpression refExpr(String format, Object... valueProviders) { + return new ReferenceExpression(format, valueProviders); + } + + public static ReferenceExpression createConditional(Object condition, String matchValue, ReferenceExpression whenTrue, ReferenceExpression whenFalse) { return new ReferenceExpression(condition, matchValue, whenTrue, whenFalse); } + + private static Object extractValueProvider(Object value) { + if (value == null) { + throw new IllegalArgumentException("Cannot use null in a reference expression"); + } + + if (value instanceof String || value instanceof Number || value instanceof Boolean) { + return value; + } + + return AspireClient.serializeValue(value); + } } /** @@ -145,8 +282,8 @@ private Handle ensureHandle() { Map args = new HashMap<>(); args.put("context", getHandle().toJson()); Object result = getClient().invokeCapability(getterCapabilityId, args); - if (result instanceof Handle) { - resolvedHandle = (Handle) result; + if (result instanceof Handle handle) { + resolvedHandle = handle; } } if (resolvedHandle == null) { @@ -183,8 +320,8 @@ private Handle ensureHandle() { Map args = new HashMap<>(); args.put("context", getHandle().toJson()); Object result = getClient().invokeCapability(getterCapabilityId, args); - if (result instanceof Handle) { - resolvedHandle = (Handle) result; + if (result instanceof Handle handle) { + resolvedHandle = handle; } } if (resolvedHandle == null) { @@ -193,3 +330,18 @@ private Handle ensureHandle() { return resolvedHandle; } } + +/** + * Registers runtime-owned wrappers defined in Base.java. + */ +final class BaseRegistrations { + private BaseRegistrations() { + } + + static { + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression", ReferenceExpression::new); + } + + static void ensureRegistered() { + } +} diff --git a/src/Aspire.Hosting.CodeGeneration.Java/Resources/Transport.java b/src/Aspire.Hosting.CodeGeneration.Java/Resources/Transport.java index cef9f1cefd9..8d19e8a71a2 100644 --- a/src/Aspire.Hosting.CodeGeneration.Java/Resources/Transport.java +++ b/src/Aspire.Hosting.CodeGeneration.Java/Resources/Transport.java @@ -306,7 +306,7 @@ private void handleServerRequest(Map request) throws IOException Object[] unwrappedArgs = args.stream() .map(this::unwrapResult) .toArray(); - result = callback.apply(unwrappedArgs); + result = awaitValue(callback.apply(unwrappedArgs)); } else { error = createError(-32601, "Callback not found: " + callbackId); } @@ -413,6 +413,13 @@ public String registerCancellation(CancellationToken token) { return id; } + public static Object awaitValue(Object value) { + if (value instanceof CompletionStage stage) { + return stage.toCompletableFuture().join(); + } + return value; + } + // Simple JSON serialization (no external dependencies) public static Object serializeValue(Object value) { if (value == null) { @@ -427,6 +434,9 @@ public static Object serializeValue(Object value) { if (value instanceof ReferenceExpression) { return ((ReferenceExpression) value).toJson(); } + if (value instanceof AspireUnion union) { + return serializeValue(union.getValue()); + } if (value instanceof Map) { @SuppressWarnings("unchecked") Map map = (Map) value; @@ -453,6 +463,9 @@ public static Object serializeValue(Object value) { } return result; } + if (value instanceof WireValueEnum wireValueEnum) { + return wireValueEnum.getValue(); + } if (value instanceof Enum) { return ((Enum) value).name(); } diff --git a/src/Aspire.Hosting.CodeGeneration.Python/AtsPythonCodeGenerator.cs b/src/Aspire.Hosting.CodeGeneration.Python/AtsPythonCodeGenerator.cs index fd4db795ff2..43beded3e8b 100644 --- a/src/Aspire.Hosting.CodeGeneration.Python/AtsPythonCodeGenerator.cs +++ b/src/Aspire.Hosting.CodeGeneration.Python/AtsPythonCodeGenerator.cs @@ -395,8 +395,14 @@ private void GenerateConnectionHelpers() WriteLine(" resolved_options.update(options.to_dict())"); WriteLine(" elif isinstance(options, dict):"); WriteLine(" resolved_options.update(options)"); - WriteLine(" resolved_options.setdefault(\"Args\", sys.argv[1:])"); - WriteLine(" resolved_options.setdefault(\"ProjectDirectory\", os.environ.get(\"ASPIRE_PROJECT_DIRECTORY\", os.getcwd()))"); + WriteLine(" if resolved_options.get(\"Args\") is None:"); + WriteLine(" resolved_options[\"Args\"] = sys.argv[1:]"); + WriteLine(" if resolved_options.get(\"ProjectDirectory\") is None:"); + WriteLine(" resolved_options[\"ProjectDirectory\"] = os.environ.get(\"ASPIRE_PROJECT_DIRECTORY\", os.getcwd())"); + WriteLine(" apphost_file_path = os.environ.get(\"ASPIRE_APPHOST_FILEPATH\")"); + WriteLine(" if apphost_file_path:"); + WriteLine(" if resolved_options.get(\"AppHostFilePath\") is None:"); + WriteLine(" resolved_options[\"AppHostFilePath\"] = apphost_file_path"); WriteLine(" result = client.invoke_capability(\"Aspire.Hosting/createBuilderWithOptions\", {\"options\": resolved_options})"); WriteLine(" return result"); WriteLine(); diff --git a/tests/Aspire.Cli.EndToEnd.Tests/Helpers/CliE2EAutomatorHelpers.cs b/tests/Aspire.Cli.EndToEnd.Tests/Helpers/CliE2EAutomatorHelpers.cs index e4363bab2c4..72fce5931f5 100644 --- a/tests/Aspire.Cli.EndToEnd.Tests/Helpers/CliE2EAutomatorHelpers.cs +++ b/tests/Aspire.Cli.EndToEnd.Tests/Helpers/CliE2EAutomatorHelpers.cs @@ -219,6 +219,18 @@ internal static Task EnablePolyglotSupportAsync( return Task.CompletedTask; } + /// + /// Enables experimental Java polyglot support for CLI tests. + /// + internal static async Task EnableExperimentalJavaSupportAsync( + this Hex1bTerminalAutomator auto, + SequenceCounter counter) + { + await auto.TypeAsync("aspire config set features:experimentalPolyglot:java true --global --non-interactive"); + await auto.EnterAsync(); + await auto.WaitForSuccessPromptAsync(counter); + } + /// /// Installs a specific GA version of the Aspire CLI using the install script. /// diff --git a/tests/Aspire.Cli.EndToEnd.Tests/Helpers/CliE2ETestHelpers.cs b/tests/Aspire.Cli.EndToEnd.Tests/Helpers/CliE2ETestHelpers.cs index ed41c1a899b..0216971c0f0 100644 --- a/tests/Aspire.Cli.EndToEnd.Tests/Helpers/CliE2ETestHelpers.cs +++ b/tests/Aspire.Cli.EndToEnd.Tests/Helpers/CliE2ETestHelpers.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Diagnostics; using System.Runtime.CompilerServices; using Aspire.Cli.Tests.Utils; using Hex1b; @@ -116,11 +117,20 @@ internal enum DockerfileVariant DotNet, /// - /// Docker + Python + Node.js (no .NET SDK). For TypeScript-only AppHost tests. + /// Docker + Node.js (no .NET SDK). For Node-based polyglot AppHost tests. /// Polyglot, + + /// + /// Docker + Node.js + Java (no .NET SDK). For Java polyglot AppHost tests. + /// + PolyglotJava, } + private const string PolyglotBaseImageName = "aspire-e2e-polyglot-base"; + private static readonly object s_polyglotBaseImageLock = new(); + private static bool s_polyglotBaseImageBuilt; + /// /// Detects the install mode for Docker-based tests based on the current environment. /// @@ -194,11 +204,17 @@ internal static Hex1bTerminal CreateDockerTestTerminal( var dockerfileName = variant switch { DockerfileVariant.DotNet => "Dockerfile.e2e", - DockerfileVariant.Polyglot => "Dockerfile.e2e-polyglot", + DockerfileVariant.Polyglot => "Dockerfile.e2e-polyglot-base", + DockerfileVariant.PolyglotJava => "Dockerfile.e2e-polyglot-java", _ => throw new ArgumentOutOfRangeException(nameof(variant)), }; var dockerfilePath = Path.Combine(repoRoot, "tests", "Shared", "Docker", dockerfileName); + if (variant is DockerfileVariant.PolyglotJava) + { + EnsurePolyglotBaseImage(repoRoot, output); + } + output.WriteLine($"Creating Docker test terminal:"); output.WriteLine($" Test name: {testName}"); output.WriteLine($" Install mode: {installMode}"); @@ -273,6 +289,57 @@ internal static Hex1bTerminal CreateDockerTestTerminal( return builder.Build(); } + private static void EnsurePolyglotBaseImage(string repoRoot, ITestOutputHelper output) + { + lock (s_polyglotBaseImageLock) + { + if (s_polyglotBaseImageBuilt) + { + return; + } + + var dockerfilePath = Path.Combine(repoRoot, "tests", "Shared", "Docker", "Dockerfile.e2e-polyglot-base"); + + output.WriteLine($"Building shared polyglot Docker base image from {dockerfilePath}"); + + var startInfo = new ProcessStartInfo("docker") + { + RedirectStandardOutput = true, + RedirectStandardError = true, + UseShellExecute = false, + }; + + startInfo.ArgumentList.Add("build"); + startInfo.ArgumentList.Add("--quiet"); + startInfo.ArgumentList.Add("--build-arg"); + startInfo.ArgumentList.Add("SKIP_SOURCE_BUILD=true"); + startInfo.ArgumentList.Add("-f"); + startInfo.ArgumentList.Add(dockerfilePath); + startInfo.ArgumentList.Add("-t"); + startInfo.ArgumentList.Add(PolyglotBaseImageName); + startInfo.ArgumentList.Add(repoRoot); + + using var process = Process.Start(startInfo) ?? throw new InvalidOperationException("Failed to start docker build process."); + var standardOutput = process.StandardOutput.ReadToEnd(); + var standardError = process.StandardError.ReadToEnd(); + process.WaitForExit(); + + if (process.ExitCode != 0) + { + throw new InvalidOperationException( + $"Failed to build shared polyglot Docker base image.{Environment.NewLine}" + + $"{standardOutput}{Environment.NewLine}{standardError}"); + } + + if (!string.IsNullOrWhiteSpace(standardOutput)) + { + output.WriteLine(standardOutput.Trim()); + } + + s_polyglotBaseImageBuilt = true; + } + } + /// /// Walks up from the test assembly directory to find the repo root (contains Aspire.slnx). /// diff --git a/tests/Aspire.Cli.EndToEnd.Tests/JavaCodegenValidationTests.cs b/tests/Aspire.Cli.EndToEnd.Tests/JavaCodegenValidationTests.cs new file mode 100644 index 00000000000..033ec31a64d --- /dev/null +++ b/tests/Aspire.Cli.EndToEnd.Tests/JavaCodegenValidationTests.cs @@ -0,0 +1,105 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Aspire.Cli.EndToEnd.Tests.Helpers; +using Aspire.Cli.Tests.Utils; +using Hex1b.Automation; +using Xunit; + +namespace Aspire.Cli.EndToEnd.Tests; + +/// +/// End-to-end tests that validate aspire restore for Java AppHosts by creating a +/// Java AppHost with multiple integrations and verifying the generated Java SDK files. +/// +public sealed class JavaCodegenValidationTests(ITestOutputHelper output) +{ + [Fact] + public async Task RestoreGeneratesSdkFiles() + { + var repoRoot = CliE2ETestHelpers.GetRepoRoot(); + var installMode = CliE2ETestHelpers.DetectDockerInstallMode(repoRoot); + var workspace = TemporaryWorkspace.Create(output); + + using var terminal = CliE2ETestHelpers.CreateDockerTestTerminal(repoRoot, installMode, output, variant: CliE2ETestHelpers.DockerfileVariant.PolyglotJava, workspace: workspace); + + var pendingRun = terminal.RunAsync(TestContext.Current.CancellationToken); + + var counter = new SequenceCounter(); + var auto = new Hex1bTerminalAutomator(terminal, defaultTimeout: TimeSpan.FromSeconds(500)); + + await auto.PrepareDockerEnvironmentAsync(counter, workspace); + await auto.InstallAspireCliInDockerAsync(installMode, counter); + await auto.EnableExperimentalJavaSupportAsync(counter); + + await auto.TypeAsync("aspire init"); + await auto.EnterAsync(); + await auto.WaitUntilTextAsync("Which language would you like to use?", timeout: TimeSpan.FromSeconds(30)); + await auto.DownAsync(); + await auto.DownAsync(); + await auto.WaitUntilTextAsync("> Java", timeout: TimeSpan.FromSeconds(5)); + await auto.EnterAsync(); + await auto.WaitUntilTextAsync("Created AppHost.java", timeout: TimeSpan.FromMinutes(2)); + await auto.DeclineAgentInitPromptAsync(counter); + + await auto.TypeAsync("aspire add Aspire.Hosting.Redis"); + await auto.EnterAsync(); + await auto.WaitUntilTextAsync("The package Aspire.Hosting.", timeout: TimeSpan.FromMinutes(2)); + await auto.WaitForSuccessPromptAsync(counter); + + await auto.TypeAsync("aspire add Aspire.Hosting.SqlServer"); + await auto.EnterAsync(); + await auto.WaitUntilTextAsync("The package Aspire.Hosting.", timeout: TimeSpan.FromMinutes(2)); + await auto.WaitForSuccessPromptAsync(counter); + + await auto.TypeAsync("aspire restore"); + await auto.EnterAsync(); + await auto.WaitUntilTextAsync("SDK code restored successfully", timeout: TimeSpan.FromMinutes(3)); + await auto.WaitForSuccessPromptAsync(counter); + + var modulesDir = Path.Combine(workspace.WorkspaceRoot.FullName, ".modules"); + if (!Directory.Exists(modulesDir)) + { + throw new InvalidOperationException($".modules directory was not created at {modulesDir}"); + } + + var expectedFiles = new[] + { + "Aspire.java", + "AspireClient.java", + "DistributedApplication.java", + "IDistributedApplicationBuilder.java", + "sources.txt" + }; + + foreach (var file in expectedFiles) + { + var filePath = Path.Combine(modulesDir, file); + if (!File.Exists(filePath)) + { + throw new InvalidOperationException($"Expected generated file not found: {filePath}"); + } + + var content = File.ReadAllText(filePath); + if (string.IsNullOrWhiteSpace(content)) + { + throw new InvalidOperationException($"Generated file is empty: {filePath}"); + } + } + + var builderJava = File.ReadAllText(Path.Combine(modulesDir, "IDistributedApplicationBuilder.java")); + if (!builderJava.Contains("addRedis")) + { + throw new InvalidOperationException("IDistributedApplicationBuilder.java does not contain addRedis from Aspire.Hosting.Redis"); + } + if (!builderJava.Contains("addSqlServer")) + { + throw new InvalidOperationException("IDistributedApplicationBuilder.java does not contain addSqlServer from Aspire.Hosting.SqlServer"); + } + + await auto.TypeAsync("exit"); + await auto.EnterAsync(); + + await pendingRun; + } +} diff --git a/tests/Aspire.Cli.EndToEnd.Tests/JavaEmptyAppHostTemplateTests.cs b/tests/Aspire.Cli.EndToEnd.Tests/JavaEmptyAppHostTemplateTests.cs new file mode 100644 index 00000000000..6e841e0817a --- /dev/null +++ b/tests/Aspire.Cli.EndToEnd.Tests/JavaEmptyAppHostTemplateTests.cs @@ -0,0 +1,50 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Aspire.Cli.EndToEnd.Tests.Helpers; +using Aspire.Cli.Tests.Utils; +using Hex1b.Automation; +using Xunit; + +namespace Aspire.Cli.EndToEnd.Tests; + +/// +/// End-to-end tests for the Java empty AppHost template (aspire-java-empty). +/// Validates that aspire new creates a working Java AppHost project +/// and that aspire start runs it successfully. +/// +public sealed class JavaEmptyAppHostTemplateTests(ITestOutputHelper output) +{ + [Fact] + public async Task CreateAndRunJavaEmptyAppHostProject() + { + var repoRoot = CliE2ETestHelpers.GetRepoRoot(); + var installMode = CliE2ETestHelpers.DetectDockerInstallMode(repoRoot); + var workspace = TemporaryWorkspace.Create(output); + + using var terminal = CliE2ETestHelpers.CreateDockerTestTerminal(repoRoot, installMode, output, variant: CliE2ETestHelpers.DockerfileVariant.PolyglotJava, mountDockerSocket: true, workspace: workspace); + + var pendingRun = terminal.RunAsync(TestContext.Current.CancellationToken); + + var counter = new SequenceCounter(); + var auto = new Hex1bTerminalAutomator(terminal, defaultTimeout: TimeSpan.FromSeconds(500)); + + await auto.PrepareDockerEnvironmentAsync(counter, workspace); + await auto.InstallAspireCliInDockerAsync(installMode, counter); + await auto.EnableExperimentalJavaSupportAsync(counter); + + await auto.AspireNewAsync("JavaEmptyApp", counter, template: AspireTemplate.JavaEmptyAppHost); + + await auto.TypeAsync("cd JavaEmptyApp"); + await auto.EnterAsync(); + await auto.WaitForSuccessPromptAsync(counter); + + await auto.AspireStartAsync(counter); + await auto.AspireStopAsync(counter); + + await auto.TypeAsync("exit"); + await auto.EnterAsync(); + + await pendingRun; + } +} diff --git a/tests/Aspire.Cli.EndToEnd.Tests/JavaPolyglotTests.cs b/tests/Aspire.Cli.EndToEnd.Tests/JavaPolyglotTests.cs new file mode 100644 index 00000000000..20824edb1e0 --- /dev/null +++ b/tests/Aspire.Cli.EndToEnd.Tests/JavaPolyglotTests.cs @@ -0,0 +1,84 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Aspire.Cli.EndToEnd.Tests.Helpers; +using Aspire.Cli.Tests.Utils; +using Hex1b.Automation; +using Xunit; + +namespace Aspire.Cli.EndToEnd.Tests; + +/// +/// End-to-end tests for Aspire CLI with a Java polyglot AppHost. +/// Tests creating a Java-based AppHost and adding a Vite application. +/// +public sealed class JavaPolyglotTests(ITestOutputHelper output) +{ + [Fact] + public async Task CreateJavaAppHostWithViteApp() + { + var repoRoot = CliE2ETestHelpers.GetRepoRoot(); + var installMode = CliE2ETestHelpers.DetectDockerInstallMode(repoRoot); + var workspace = TemporaryWorkspace.Create(output); + + using var terminal = CliE2ETestHelpers.CreateDockerTestTerminal(repoRoot, installMode, output, variant: CliE2ETestHelpers.DockerfileVariant.PolyglotJava, mountDockerSocket: true, workspace: workspace); + + var pendingRun = terminal.RunAsync(TestContext.Current.CancellationToken); + + var counter = new SequenceCounter(); + var auto = new Hex1bTerminalAutomator(terminal, defaultTimeout: TimeSpan.FromSeconds(500)); + + await auto.PrepareDockerEnvironmentAsync(counter, workspace); + await auto.InstallAspireCliInDockerAsync(installMode, counter); + await auto.EnableExperimentalJavaSupportAsync(counter); + + await auto.TypeAsync("aspire init"); + await auto.EnterAsync(); + await auto.WaitUntilTextAsync("Which language would you like to use?", timeout: TimeSpan.FromSeconds(30)); + await auto.DownAsync(); + await auto.DownAsync(); + await auto.WaitUntilTextAsync("> Java", timeout: TimeSpan.FromSeconds(5)); + await auto.EnterAsync(); + await auto.WaitUntilTextAsync("Created AppHost.java", timeout: TimeSpan.FromMinutes(2)); + await auto.DeclineAgentInitPromptAsync(counter); + + await auto.TypeAsync("npm create -y vite@latest viteapp -- --template vanilla-ts --no-interactive"); + await auto.EnterAsync(); + await auto.WaitForSuccessPromptAsync(counter, TimeSpan.FromMinutes(2)); + + await auto.TypeAsync("cd viteapp && npm install && cd .."); + await auto.EnterAsync(); + await auto.WaitForSuccessPromptAsync(counter, TimeSpan.FromMinutes(2)); + + await auto.TypeAsync("aspire add Aspire.Hosting.JavaScript"); + await auto.EnterAsync(); + await auto.WaitUntilTextAsync("The package Aspire.Hosting.", timeout: TimeSpan.FromMinutes(2)); + await auto.WaitForSuccessPromptAsync(counter); + + var appHostPath = Path.Combine(workspace.WorkspaceRoot.FullName, "AppHost.java"); + var newContent = """ + import aspire.*; + + void main(String[] args) throws Exception { + var builder = DistributedApplication.CreateBuilder(args); + + ViteAppResource viteApp = builder.addViteApp("viteapp", "./viteapp"); + + builder.build().run(); + } + """; + + File.WriteAllText(appHostPath, newContent); + + await auto.TypeAsync("aspire run"); + await auto.EnterAsync(); + await auto.WaitUntilTextAsync("Press CTRL+C to stop the apphost and exit.", timeout: TimeSpan.FromMinutes(3)); + + await auto.Ctrl().KeyAsync(Hex1b.Input.Hex1bKey.C); + await auto.WaitForSuccessPromptAsync(counter); + await auto.TypeAsync("exit"); + await auto.EnterAsync(); + + await pendingRun; + } +} diff --git a/tests/Aspire.Cli.Tests/Commands/NewCommandTests.cs b/tests/Aspire.Cli.Tests/Commands/NewCommandTests.cs index d671a48055d..a3f2eccba3a 100644 --- a/tests/Aspire.Cli.Tests/Commands/NewCommandTests.cs +++ b/tests/Aspire.Cli.Tests/Commands/NewCommandTests.cs @@ -45,6 +45,30 @@ public void NewCommandWithPolyglotEnabled_ExposesTemplateSubcommands() using var workspace = TemporaryWorkspace.Create(outputHelper); var services = CliTestHelper.CreateServiceCollection(workspace, outputHelper, options => { + options.FeatureFlagsFactory = _ => + { + var features = new TestFeatures(); + features.SetFeature(KnownFeatures.ExperimentalPolyglotJava, true); + return features; + }; + + options.DotNetCliRunnerFactory = (sp) => + { + var runner = new TestDotNetCliRunner(); + runner.SearchPackagesAsyncCallback = (dir, query, prerelease, take, skip, nugetSource, useCache, options, cancellationToken) => + { + var package = new NuGetPackage() + { + Id = "Aspire.ProjectTemplates", + Source = "nuget", + Version = "9.2.0" + }; + + return (0, new NuGetPackage[] { package }); + }; + + return runner; + }; }); var provider = services.BuildServiceProvider(); @@ -52,6 +76,7 @@ public void NewCommandWithPolyglotEnabled_ExposesTemplateSubcommands() Assert.NotEmpty(command.Subcommands); Assert.Contains(command.Subcommands, subcommand => subcommand.Name == KnownTemplateId.CSharpEmptyAppHost && subcommand.Description == "Empty (C# AppHost)"); Assert.Contains(command.Subcommands, subcommand => subcommand.Name == KnownTemplateId.TypeScriptEmptyAppHost && subcommand.Description == "Empty (TypeScript AppHost)"); + Assert.Contains(command.Subcommands, subcommand => subcommand.Name == KnownTemplateId.JavaEmptyAppHost && subcommand.Description == "Empty (Java AppHost)"); } [Fact] @@ -983,6 +1008,60 @@ public async Task NewCommandWithoutTemplatePromptsWithDistinctLanguageSpecificEm Assert.Contains("Empty (TypeScript AppHost)", promptedTemplateDescriptions); } + [Fact] + public async Task NewCommandWithExplicitJavaEmptyTemplateCreatesJavaAppHost() + { + using var workspace = TemporaryWorkspace.Create(outputHelper); + string? scaffoldedLanguageId = null; + + var services = CliTestHelper.CreateServiceCollection(workspace, outputHelper, options => + { + options.FeatureFlagsFactory = _ => + { + var features = new TestFeatures(); + features.SetFeature(KnownFeatures.ExperimentalPolyglotJava, true); + return features; + }; + + options.DotNetCliRunnerFactory = (sp) => + { + var runner = new TestDotNetCliRunner(); + runner.SearchPackagesAsyncCallback = (dir, query, prerelease, take, skip, nugetSource, useCache, options, cancellationToken) => + { + var package = new NuGetPackage() + { + Id = "Aspire.ProjectTemplates", + Source = "nuget", + Version = "9.2.0" + }; + + return (0, new NuGetPackage[] { package }); + }; + + return runner; + }; + }); + + services.AddSingleton(new TestScaffoldingService + { + ScaffoldAsyncCallback = (context, cancellationToken) => + { + scaffoldedLanguageId = context.Language.LanguageId.Value; + File.WriteAllText(Path.Combine(context.TargetDirectory.FullName, "AppHost.java"), "package aspire;"); + return Task.FromResult(true); + } + }); + + var provider = services.BuildServiceProvider(); + var command = provider.GetRequiredService(); + var result = command.Parse("new aspire-java-empty --name TestApp --output . --localhost-tld false"); + + var exitCode = await result.InvokeAsync().DefaultTimeout(); + Assert.Equal(0, exitCode); + Assert.Equal(KnownLanguageId.Java, scaffoldedLanguageId); + Assert.True(File.Exists(Path.Combine(workspace.WorkspaceRoot.FullName, "AppHost.java"))); + } + [Fact] public async Task NewCommandWithExplicitCSharpEmptyTemplateCreatesCSharpAppHost() { diff --git a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureSqlDeploymentScriptTests.SqlWithPrivateEndpoint_AutoCreatesBothSubnetAndStorage.verified.bicep b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureSqlDeploymentScriptTests.SqlWithPrivateEndpoint_AutoCreatesBothSubnetAndStorage.verified.bicep index e75bbbbd588..6c05d886be4 100644 --- a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureSqlDeploymentScriptTests.SqlWithPrivateEndpoint_AutoCreatesBothSubnetAndStorage.verified.bicep +++ b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureSqlDeploymentScriptTests.SqlWithPrivateEndpoint_AutoCreatesBothSubnetAndStorage.verified.bicep @@ -103,7 +103,7 @@ resource script_sql_db 'Microsoft.Resources/deploymentScripts@2023-08-01' = { value: mi.properties.clientId } ] - scriptContent: '\$sqlServerFqdn = "\$env:DBSERVER"\n\$sqlDatabaseName = "\$env:DBNAME"\n\$principalName = "\$env:PRINCIPALNAME"\n\$id = "\$env:ID"\n\n# Install SqlServer module - using specific version to avoid breaking changes in 22.4.5.1 (see https://github.com/dotnet/aspire/issues/9926)\nInstall-Module -Name SqlServer -RequiredVersion 22.3.0 -Force -AllowClobber -Scope CurrentUser\nImport-Module SqlServer\n\n\$sqlCmd = @"\nDECLARE @name SYSNAME = \'\$principalName\';\nDECLARE @id UNIQUEIDENTIFIER = \'\$id\';\n\n-- Convert the guid to the right type\nDECLARE @castId NVARCHAR(MAX) = CONVERT(VARCHAR(MAX), CONVERT (VARBINARY(16), @id), 1);\n\n-- Construct command: CREATE USER [@name] WITH SID = @castId, TYPE = E;\nDECLARE @cmd NVARCHAR(MAX) = N\'CREATE USER [\' + @name + \'] WITH SID = \' + @castId + \', TYPE = E;\'\nEXEC (@cmd);\n\n-- Assign roles to the new user\nDECLARE @role1 NVARCHAR(MAX) = N\'ALTER ROLE db_owner ADD MEMBER [\' + @name + \']\';\nEXEC (@role1);\n\n"@\n# Note: the string terminator must not have whitespace before it, therefore it is not indented.\n\nWrite-Host \$sqlCmd\n\n\$connectionString = "Server=tcp:\${sqlServerFqdn},1433;Initial Catalog=\${sqlDatabaseName};Authentication=Active Directory Default;"\n\n\$maxRetries = 5\n\$retryDelay = 60\n\$attempt = 0\n\$success = \$false\n\nwhile (-not \$success -and \$attempt -lt \$maxRetries) {\n \$attempt++\n Write-Host "Attempt \$attempt of \$maxRetries..."\n try {\n Invoke-Sqlcmd -ConnectionString \$connectionString -Query \$sqlCmd\n \$success = \$true\n Write-Host "SQL command succeeded on attempt \$attempt."\n } catch {\n Write-Host "Attempt \$attempt failed: \$_"\n if (\$attempt -lt \$maxRetries) {\n Write-Host "Retrying in \$retryDelay seconds..."\n Start-Sleep -Seconds \$retryDelay\n } else {\n throw\n }\n }\n}' + scriptContent: '\$sqlServerFqdn = "\$env:DBSERVER"\n\$sqlDatabaseName = "\$env:DBNAME"\n\$principalName = "\$env:PRINCIPALNAME"\n\$id = "\$env:ID"\n\n# Install SqlServer module - using specific version to avoid breaking changes in 22.4.5.1 (see https://github.com/microsoft/aspire/issues/9926)\nInstall-Module -Name SqlServer -RequiredVersion 22.3.0 -Force -AllowClobber -Scope CurrentUser\nImport-Module SqlServer\n\n\$sqlCmd = @"\nDECLARE @name SYSNAME = \'\$principalName\';\nDECLARE @id UNIQUEIDENTIFIER = \'\$id\';\n\n-- Convert the guid to the right type\nDECLARE @castId NVARCHAR(MAX) = CONVERT(VARCHAR(MAX), CONVERT (VARBINARY(16), @id), 1);\n\n-- Construct command: CREATE USER [@name] WITH SID = @castId, TYPE = E;\nDECLARE @cmd NVARCHAR(MAX) = N\'CREATE USER [\' + @name + \'] WITH SID = \' + @castId + \', TYPE = E;\'\nEXEC (@cmd);\n\n-- Assign roles to the new user\nDECLARE @role1 NVARCHAR(MAX) = N\'ALTER ROLE db_owner ADD MEMBER [\' + @name + \']\';\nEXEC (@role1);\n\n"@\n# Note: the string terminator must not have whitespace before it, therefore it is not indented.\n\nWrite-Host \$sqlCmd\n\n\$connectionString = "Server=tcp:\${sqlServerFqdn},1433;Initial Catalog=\${sqlDatabaseName};Authentication=Active Directory Default;"\n\n\$maxRetries = 5\n\$retryDelay = 60\n\$attempt = 0\n\$success = \$false\n\nwhile (-not \$success -and \$attempt -lt \$maxRetries) {\n \$attempt++\n Write-Host "Attempt \$attempt of \$maxRetries..."\n try {\n Invoke-Sqlcmd -ConnectionString \$connectionString -Query \$sqlCmd\n \$success = \$true\n Write-Host "SQL command succeeded on attempt \$attempt."\n } catch {\n Write-Host "Attempt \$attempt failed: \$_"\n if (\$attempt -lt \$maxRetries) {\n Write-Host "Retrying in \$retryDelay seconds..."\n Start-Sleep -Seconds \$retryDelay\n } else {\n throw\n }\n }\n}' storageAccountSettings: { storageAccountName: sql_store_outputs_name } diff --git a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureSqlDeploymentScriptTests.SqlWithPrivateEndpoint_BothExplicitSubnetAndStorage.verified.bicep b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureSqlDeploymentScriptTests.SqlWithPrivateEndpoint_BothExplicitSubnetAndStorage.verified.bicep index e3d1e16e20b..ccbaa57fc5d 100644 --- a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureSqlDeploymentScriptTests.SqlWithPrivateEndpoint_BothExplicitSubnetAndStorage.verified.bicep +++ b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureSqlDeploymentScriptTests.SqlWithPrivateEndpoint_BothExplicitSubnetAndStorage.verified.bicep @@ -103,7 +103,7 @@ resource script_sql_db 'Microsoft.Resources/deploymentScripts@2023-08-01' = { value: mi.properties.clientId } ] - scriptContent: '\$sqlServerFqdn = "\$env:DBSERVER"\n\$sqlDatabaseName = "\$env:DBNAME"\n\$principalName = "\$env:PRINCIPALNAME"\n\$id = "\$env:ID"\n\n# Install SqlServer module - using specific version to avoid breaking changes in 22.4.5.1 (see https://github.com/dotnet/aspire/issues/9926)\nInstall-Module -Name SqlServer -RequiredVersion 22.3.0 -Force -AllowClobber -Scope CurrentUser\nImport-Module SqlServer\n\n\$sqlCmd = @"\nDECLARE @name SYSNAME = \'\$principalName\';\nDECLARE @id UNIQUEIDENTIFIER = \'\$id\';\n\n-- Convert the guid to the right type\nDECLARE @castId NVARCHAR(MAX) = CONVERT(VARCHAR(MAX), CONVERT (VARBINARY(16), @id), 1);\n\n-- Construct command: CREATE USER [@name] WITH SID = @castId, TYPE = E;\nDECLARE @cmd NVARCHAR(MAX) = N\'CREATE USER [\' + @name + \'] WITH SID = \' + @castId + \', TYPE = E;\'\nEXEC (@cmd);\n\n-- Assign roles to the new user\nDECLARE @role1 NVARCHAR(MAX) = N\'ALTER ROLE db_owner ADD MEMBER [\' + @name + \']\';\nEXEC (@role1);\n\n"@\n# Note: the string terminator must not have whitespace before it, therefore it is not indented.\n\nWrite-Host \$sqlCmd\n\n\$connectionString = "Server=tcp:\${sqlServerFqdn},1433;Initial Catalog=\${sqlDatabaseName};Authentication=Active Directory Default;"\n\n\$maxRetries = 5\n\$retryDelay = 60\n\$attempt = 0\n\$success = \$false\n\nwhile (-not \$success -and \$attempt -lt \$maxRetries) {\n \$attempt++\n Write-Host "Attempt \$attempt of \$maxRetries..."\n try {\n Invoke-Sqlcmd -ConnectionString \$connectionString -Query \$sqlCmd\n \$success = \$true\n Write-Host "SQL command succeeded on attempt \$attempt."\n } catch {\n Write-Host "Attempt \$attempt failed: \$_"\n if (\$attempt -lt \$maxRetries) {\n Write-Host "Retrying in \$retryDelay seconds..."\n Start-Sleep -Seconds \$retryDelay\n } else {\n throw\n }\n }\n}' + scriptContent: '\$sqlServerFqdn = "\$env:DBSERVER"\n\$sqlDatabaseName = "\$env:DBNAME"\n\$principalName = "\$env:PRINCIPALNAME"\n\$id = "\$env:ID"\n\n# Install SqlServer module - using specific version to avoid breaking changes in 22.4.5.1 (see https://github.com/microsoft/aspire/issues/9926)\nInstall-Module -Name SqlServer -RequiredVersion 22.3.0 -Force -AllowClobber -Scope CurrentUser\nImport-Module SqlServer\n\n\$sqlCmd = @"\nDECLARE @name SYSNAME = \'\$principalName\';\nDECLARE @id UNIQUEIDENTIFIER = \'\$id\';\n\n-- Convert the guid to the right type\nDECLARE @castId NVARCHAR(MAX) = CONVERT(VARCHAR(MAX), CONVERT (VARBINARY(16), @id), 1);\n\n-- Construct command: CREATE USER [@name] WITH SID = @castId, TYPE = E;\nDECLARE @cmd NVARCHAR(MAX) = N\'CREATE USER [\' + @name + \'] WITH SID = \' + @castId + \', TYPE = E;\'\nEXEC (@cmd);\n\n-- Assign roles to the new user\nDECLARE @role1 NVARCHAR(MAX) = N\'ALTER ROLE db_owner ADD MEMBER [\' + @name + \']\';\nEXEC (@role1);\n\n"@\n# Note: the string terminator must not have whitespace before it, therefore it is not indented.\n\nWrite-Host \$sqlCmd\n\n\$connectionString = "Server=tcp:\${sqlServerFqdn},1433;Initial Catalog=\${sqlDatabaseName};Authentication=Active Directory Default;"\n\n\$maxRetries = 5\n\$retryDelay = 60\n\$attempt = 0\n\$success = \$false\n\nwhile (-not \$success -and \$attempt -lt \$maxRetries) {\n \$attempt++\n Write-Host "Attempt \$attempt of \$maxRetries..."\n try {\n Invoke-Sqlcmd -ConnectionString \$connectionString -Query \$sqlCmd\n \$success = \$true\n Write-Host "SQL command succeeded on attempt \$attempt."\n } catch {\n Write-Host "Attempt \$attempt failed: \$_"\n if (\$attempt -lt \$maxRetries) {\n Write-Host "Retrying in \$retryDelay seconds..."\n Start-Sleep -Seconds \$retryDelay\n } else {\n throw\n }\n }\n}' storageAccountSettings: { storageAccountName: depscriptstorage_outputs_name } diff --git a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureSqlDeploymentScriptTests.SqlWithPrivateEndpoint_ExplicitStorage_AutoCreatesSubnet.verified.bicep b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureSqlDeploymentScriptTests.SqlWithPrivateEndpoint_ExplicitStorage_AutoCreatesSubnet.verified.bicep index 6cad2dbdba5..354ec95a6fb 100644 --- a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureSqlDeploymentScriptTests.SqlWithPrivateEndpoint_ExplicitStorage_AutoCreatesSubnet.verified.bicep +++ b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureSqlDeploymentScriptTests.SqlWithPrivateEndpoint_ExplicitStorage_AutoCreatesSubnet.verified.bicep @@ -103,7 +103,7 @@ resource script_sql_db 'Microsoft.Resources/deploymentScripts@2023-08-01' = { value: mi.properties.clientId } ] - scriptContent: '\$sqlServerFqdn = "\$env:DBSERVER"\n\$sqlDatabaseName = "\$env:DBNAME"\n\$principalName = "\$env:PRINCIPALNAME"\n\$id = "\$env:ID"\n\n# Install SqlServer module - using specific version to avoid breaking changes in 22.4.5.1 (see https://github.com/dotnet/aspire/issues/9926)\nInstall-Module -Name SqlServer -RequiredVersion 22.3.0 -Force -AllowClobber -Scope CurrentUser\nImport-Module SqlServer\n\n\$sqlCmd = @"\nDECLARE @name SYSNAME = \'\$principalName\';\nDECLARE @id UNIQUEIDENTIFIER = \'\$id\';\n\n-- Convert the guid to the right type\nDECLARE @castId NVARCHAR(MAX) = CONVERT(VARCHAR(MAX), CONVERT (VARBINARY(16), @id), 1);\n\n-- Construct command: CREATE USER [@name] WITH SID = @castId, TYPE = E;\nDECLARE @cmd NVARCHAR(MAX) = N\'CREATE USER [\' + @name + \'] WITH SID = \' + @castId + \', TYPE = E;\'\nEXEC (@cmd);\n\n-- Assign roles to the new user\nDECLARE @role1 NVARCHAR(MAX) = N\'ALTER ROLE db_owner ADD MEMBER [\' + @name + \']\';\nEXEC (@role1);\n\n"@\n# Note: the string terminator must not have whitespace before it, therefore it is not indented.\n\nWrite-Host \$sqlCmd\n\n\$connectionString = "Server=tcp:\${sqlServerFqdn},1433;Initial Catalog=\${sqlDatabaseName};Authentication=Active Directory Default;"\n\n\$maxRetries = 5\n\$retryDelay = 60\n\$attempt = 0\n\$success = \$false\n\nwhile (-not \$success -and \$attempt -lt \$maxRetries) {\n \$attempt++\n Write-Host "Attempt \$attempt of \$maxRetries..."\n try {\n Invoke-Sqlcmd -ConnectionString \$connectionString -Query \$sqlCmd\n \$success = \$true\n Write-Host "SQL command succeeded on attempt \$attempt."\n } catch {\n Write-Host "Attempt \$attempt failed: \$_"\n if (\$attempt -lt \$maxRetries) {\n Write-Host "Retrying in \$retryDelay seconds..."\n Start-Sleep -Seconds \$retryDelay\n } else {\n throw\n }\n }\n}' + scriptContent: '\$sqlServerFqdn = "\$env:DBSERVER"\n\$sqlDatabaseName = "\$env:DBNAME"\n\$principalName = "\$env:PRINCIPALNAME"\n\$id = "\$env:ID"\n\n# Install SqlServer module - using specific version to avoid breaking changes in 22.4.5.1 (see https://github.com/microsoft/aspire/issues/9926)\nInstall-Module -Name SqlServer -RequiredVersion 22.3.0 -Force -AllowClobber -Scope CurrentUser\nImport-Module SqlServer\n\n\$sqlCmd = @"\nDECLARE @name SYSNAME = \'\$principalName\';\nDECLARE @id UNIQUEIDENTIFIER = \'\$id\';\n\n-- Convert the guid to the right type\nDECLARE @castId NVARCHAR(MAX) = CONVERT(VARCHAR(MAX), CONVERT (VARBINARY(16), @id), 1);\n\n-- Construct command: CREATE USER [@name] WITH SID = @castId, TYPE = E;\nDECLARE @cmd NVARCHAR(MAX) = N\'CREATE USER [\' + @name + \'] WITH SID = \' + @castId + \', TYPE = E;\'\nEXEC (@cmd);\n\n-- Assign roles to the new user\nDECLARE @role1 NVARCHAR(MAX) = N\'ALTER ROLE db_owner ADD MEMBER [\' + @name + \']\';\nEXEC (@role1);\n\n"@\n# Note: the string terminator must not have whitespace before it, therefore it is not indented.\n\nWrite-Host \$sqlCmd\n\n\$connectionString = "Server=tcp:\${sqlServerFqdn},1433;Initial Catalog=\${sqlDatabaseName};Authentication=Active Directory Default;"\n\n\$maxRetries = 5\n\$retryDelay = 60\n\$attempt = 0\n\$success = \$false\n\nwhile (-not \$success -and \$attempt -lt \$maxRetries) {\n \$attempt++\n Write-Host "Attempt \$attempt of \$maxRetries..."\n try {\n Invoke-Sqlcmd -ConnectionString \$connectionString -Query \$sqlCmd\n \$success = \$true\n Write-Host "SQL command succeeded on attempt \$attempt."\n } catch {\n Write-Host "Attempt \$attempt failed: \$_"\n if (\$attempt -lt \$maxRetries) {\n Write-Host "Retrying in \$retryDelay seconds..."\n Start-Sleep -Seconds \$retryDelay\n } else {\n throw\n }\n }\n}' storageAccountSettings: { storageAccountName: depscriptstorage_outputs_name } diff --git a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureSqlDeploymentScriptTests.SqlWithPrivateEndpoint_ExplicitSubnet_AutoCreatesStorage.verified.bicep b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureSqlDeploymentScriptTests.SqlWithPrivateEndpoint_ExplicitSubnet_AutoCreatesStorage.verified.bicep index 37026f1fdf2..d26d29f74e3 100644 --- a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureSqlDeploymentScriptTests.SqlWithPrivateEndpoint_ExplicitSubnet_AutoCreatesStorage.verified.bicep +++ b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureSqlDeploymentScriptTests.SqlWithPrivateEndpoint_ExplicitSubnet_AutoCreatesStorage.verified.bicep @@ -103,7 +103,7 @@ resource script_sql_db 'Microsoft.Resources/deploymentScripts@2023-08-01' = { value: mi.properties.clientId } ] - scriptContent: '\$sqlServerFqdn = "\$env:DBSERVER"\n\$sqlDatabaseName = "\$env:DBNAME"\n\$principalName = "\$env:PRINCIPALNAME"\n\$id = "\$env:ID"\n\n# Install SqlServer module - using specific version to avoid breaking changes in 22.4.5.1 (see https://github.com/dotnet/aspire/issues/9926)\nInstall-Module -Name SqlServer -RequiredVersion 22.3.0 -Force -AllowClobber -Scope CurrentUser\nImport-Module SqlServer\n\n\$sqlCmd = @"\nDECLARE @name SYSNAME = \'\$principalName\';\nDECLARE @id UNIQUEIDENTIFIER = \'\$id\';\n\n-- Convert the guid to the right type\nDECLARE @castId NVARCHAR(MAX) = CONVERT(VARCHAR(MAX), CONVERT (VARBINARY(16), @id), 1);\n\n-- Construct command: CREATE USER [@name] WITH SID = @castId, TYPE = E;\nDECLARE @cmd NVARCHAR(MAX) = N\'CREATE USER [\' + @name + \'] WITH SID = \' + @castId + \', TYPE = E;\'\nEXEC (@cmd);\n\n-- Assign roles to the new user\nDECLARE @role1 NVARCHAR(MAX) = N\'ALTER ROLE db_owner ADD MEMBER [\' + @name + \']\';\nEXEC (@role1);\n\n"@\n# Note: the string terminator must not have whitespace before it, therefore it is not indented.\n\nWrite-Host \$sqlCmd\n\n\$connectionString = "Server=tcp:\${sqlServerFqdn},1433;Initial Catalog=\${sqlDatabaseName};Authentication=Active Directory Default;"\n\n\$maxRetries = 5\n\$retryDelay = 60\n\$attempt = 0\n\$success = \$false\n\nwhile (-not \$success -and \$attempt -lt \$maxRetries) {\n \$attempt++\n Write-Host "Attempt \$attempt of \$maxRetries..."\n try {\n Invoke-Sqlcmd -ConnectionString \$connectionString -Query \$sqlCmd\n \$success = \$true\n Write-Host "SQL command succeeded on attempt \$attempt."\n } catch {\n Write-Host "Attempt \$attempt failed: \$_"\n if (\$attempt -lt \$maxRetries) {\n Write-Host "Retrying in \$retryDelay seconds..."\n Start-Sleep -Seconds \$retryDelay\n } else {\n throw\n }\n }\n}' + scriptContent: '\$sqlServerFqdn = "\$env:DBSERVER"\n\$sqlDatabaseName = "\$env:DBNAME"\n\$principalName = "\$env:PRINCIPALNAME"\n\$id = "\$env:ID"\n\n# Install SqlServer module - using specific version to avoid breaking changes in 22.4.5.1 (see https://github.com/microsoft/aspire/issues/9926)\nInstall-Module -Name SqlServer -RequiredVersion 22.3.0 -Force -AllowClobber -Scope CurrentUser\nImport-Module SqlServer\n\n\$sqlCmd = @"\nDECLARE @name SYSNAME = \'\$principalName\';\nDECLARE @id UNIQUEIDENTIFIER = \'\$id\';\n\n-- Convert the guid to the right type\nDECLARE @castId NVARCHAR(MAX) = CONVERT(VARCHAR(MAX), CONVERT (VARBINARY(16), @id), 1);\n\n-- Construct command: CREATE USER [@name] WITH SID = @castId, TYPE = E;\nDECLARE @cmd NVARCHAR(MAX) = N\'CREATE USER [\' + @name + \'] WITH SID = \' + @castId + \', TYPE = E;\'\nEXEC (@cmd);\n\n-- Assign roles to the new user\nDECLARE @role1 NVARCHAR(MAX) = N\'ALTER ROLE db_owner ADD MEMBER [\' + @name + \']\';\nEXEC (@role1);\n\n"@\n# Note: the string terminator must not have whitespace before it, therefore it is not indented.\n\nWrite-Host \$sqlCmd\n\n\$connectionString = "Server=tcp:\${sqlServerFqdn},1433;Initial Catalog=\${sqlDatabaseName};Authentication=Active Directory Default;"\n\n\$maxRetries = 5\n\$retryDelay = 60\n\$attempt = 0\n\$success = \$false\n\nwhile (-not \$success -and \$attempt -lt \$maxRetries) {\n \$attempt++\n Write-Host "Attempt \$attempt of \$maxRetries..."\n try {\n Invoke-Sqlcmd -ConnectionString \$connectionString -Query \$sqlCmd\n \$success = \$true\n Write-Host "SQL command succeeded on attempt \$attempt."\n } catch {\n Write-Host "Attempt \$attempt failed: \$_"\n if (\$attempt -lt \$maxRetries) {\n Write-Host "Retrying in \$retryDelay seconds..."\n Start-Sleep -Seconds \$retryDelay\n } else {\n throw\n }\n }\n}' storageAccountSettings: { storageAccountName: sql_store_outputs_name } diff --git a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureSqlDeploymentScriptTests.SqlWithPrivateEndpoint_StorageBeforePrivateEndpoint.verified.bicep b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureSqlDeploymentScriptTests.SqlWithPrivateEndpoint_StorageBeforePrivateEndpoint.verified.bicep index 6cad2dbdba5..354ec95a6fb 100644 --- a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureSqlDeploymentScriptTests.SqlWithPrivateEndpoint_StorageBeforePrivateEndpoint.verified.bicep +++ b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureSqlDeploymentScriptTests.SqlWithPrivateEndpoint_StorageBeforePrivateEndpoint.verified.bicep @@ -103,7 +103,7 @@ resource script_sql_db 'Microsoft.Resources/deploymentScripts@2023-08-01' = { value: mi.properties.clientId } ] - scriptContent: '\$sqlServerFqdn = "\$env:DBSERVER"\n\$sqlDatabaseName = "\$env:DBNAME"\n\$principalName = "\$env:PRINCIPALNAME"\n\$id = "\$env:ID"\n\n# Install SqlServer module - using specific version to avoid breaking changes in 22.4.5.1 (see https://github.com/dotnet/aspire/issues/9926)\nInstall-Module -Name SqlServer -RequiredVersion 22.3.0 -Force -AllowClobber -Scope CurrentUser\nImport-Module SqlServer\n\n\$sqlCmd = @"\nDECLARE @name SYSNAME = \'\$principalName\';\nDECLARE @id UNIQUEIDENTIFIER = \'\$id\';\n\n-- Convert the guid to the right type\nDECLARE @castId NVARCHAR(MAX) = CONVERT(VARCHAR(MAX), CONVERT (VARBINARY(16), @id), 1);\n\n-- Construct command: CREATE USER [@name] WITH SID = @castId, TYPE = E;\nDECLARE @cmd NVARCHAR(MAX) = N\'CREATE USER [\' + @name + \'] WITH SID = \' + @castId + \', TYPE = E;\'\nEXEC (@cmd);\n\n-- Assign roles to the new user\nDECLARE @role1 NVARCHAR(MAX) = N\'ALTER ROLE db_owner ADD MEMBER [\' + @name + \']\';\nEXEC (@role1);\n\n"@\n# Note: the string terminator must not have whitespace before it, therefore it is not indented.\n\nWrite-Host \$sqlCmd\n\n\$connectionString = "Server=tcp:\${sqlServerFqdn},1433;Initial Catalog=\${sqlDatabaseName};Authentication=Active Directory Default;"\n\n\$maxRetries = 5\n\$retryDelay = 60\n\$attempt = 0\n\$success = \$false\n\nwhile (-not \$success -and \$attempt -lt \$maxRetries) {\n \$attempt++\n Write-Host "Attempt \$attempt of \$maxRetries..."\n try {\n Invoke-Sqlcmd -ConnectionString \$connectionString -Query \$sqlCmd\n \$success = \$true\n Write-Host "SQL command succeeded on attempt \$attempt."\n } catch {\n Write-Host "Attempt \$attempt failed: \$_"\n if (\$attempt -lt \$maxRetries) {\n Write-Host "Retrying in \$retryDelay seconds..."\n Start-Sleep -Seconds \$retryDelay\n } else {\n throw\n }\n }\n}' + scriptContent: '\$sqlServerFqdn = "\$env:DBSERVER"\n\$sqlDatabaseName = "\$env:DBNAME"\n\$principalName = "\$env:PRINCIPALNAME"\n\$id = "\$env:ID"\n\n# Install SqlServer module - using specific version to avoid breaking changes in 22.4.5.1 (see https://github.com/microsoft/aspire/issues/9926)\nInstall-Module -Name SqlServer -RequiredVersion 22.3.0 -Force -AllowClobber -Scope CurrentUser\nImport-Module SqlServer\n\n\$sqlCmd = @"\nDECLARE @name SYSNAME = \'\$principalName\';\nDECLARE @id UNIQUEIDENTIFIER = \'\$id\';\n\n-- Convert the guid to the right type\nDECLARE @castId NVARCHAR(MAX) = CONVERT(VARCHAR(MAX), CONVERT (VARBINARY(16), @id), 1);\n\n-- Construct command: CREATE USER [@name] WITH SID = @castId, TYPE = E;\nDECLARE @cmd NVARCHAR(MAX) = N\'CREATE USER [\' + @name + \'] WITH SID = \' + @castId + \', TYPE = E;\'\nEXEC (@cmd);\n\n-- Assign roles to the new user\nDECLARE @role1 NVARCHAR(MAX) = N\'ALTER ROLE db_owner ADD MEMBER [\' + @name + \']\';\nEXEC (@role1);\n\n"@\n# Note: the string terminator must not have whitespace before it, therefore it is not indented.\n\nWrite-Host \$sqlCmd\n\n\$connectionString = "Server=tcp:\${sqlServerFqdn},1433;Initial Catalog=\${sqlDatabaseName};Authentication=Active Directory Default;"\n\n\$maxRetries = 5\n\$retryDelay = 60\n\$attempt = 0\n\$success = \$false\n\nwhile (-not \$success -and \$attempt -lt \$maxRetries) {\n \$attempt++\n Write-Host "Attempt \$attempt of \$maxRetries..."\n try {\n Invoke-Sqlcmd -ConnectionString \$connectionString -Query \$sqlCmd\n \$success = \$true\n Write-Host "SQL command succeeded on attempt \$attempt."\n } catch {\n Write-Host "Attempt \$attempt failed: \$_"\n if (\$attempt -lt \$maxRetries) {\n Write-Host "Retrying in \$retryDelay seconds..."\n Start-Sleep -Seconds \$retryDelay\n } else {\n throw\n }\n }\n}' storageAccountSettings: { storageAccountName: depscriptstorage_outputs_name } diff --git a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureSqlDeploymentScriptTests.SqlWithPrivateEndpoint_SubnetBeforePrivateEndpoint.verified.bicep b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureSqlDeploymentScriptTests.SqlWithPrivateEndpoint_SubnetBeforePrivateEndpoint.verified.bicep index 37026f1fdf2..d26d29f74e3 100644 --- a/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureSqlDeploymentScriptTests.SqlWithPrivateEndpoint_SubnetBeforePrivateEndpoint.verified.bicep +++ b/tests/Aspire.Hosting.Azure.Tests/Snapshots/AzureSqlDeploymentScriptTests.SqlWithPrivateEndpoint_SubnetBeforePrivateEndpoint.verified.bicep @@ -103,7 +103,7 @@ resource script_sql_db 'Microsoft.Resources/deploymentScripts@2023-08-01' = { value: mi.properties.clientId } ] - scriptContent: '\$sqlServerFqdn = "\$env:DBSERVER"\n\$sqlDatabaseName = "\$env:DBNAME"\n\$principalName = "\$env:PRINCIPALNAME"\n\$id = "\$env:ID"\n\n# Install SqlServer module - using specific version to avoid breaking changes in 22.4.5.1 (see https://github.com/dotnet/aspire/issues/9926)\nInstall-Module -Name SqlServer -RequiredVersion 22.3.0 -Force -AllowClobber -Scope CurrentUser\nImport-Module SqlServer\n\n\$sqlCmd = @"\nDECLARE @name SYSNAME = \'\$principalName\';\nDECLARE @id UNIQUEIDENTIFIER = \'\$id\';\n\n-- Convert the guid to the right type\nDECLARE @castId NVARCHAR(MAX) = CONVERT(VARCHAR(MAX), CONVERT (VARBINARY(16), @id), 1);\n\n-- Construct command: CREATE USER [@name] WITH SID = @castId, TYPE = E;\nDECLARE @cmd NVARCHAR(MAX) = N\'CREATE USER [\' + @name + \'] WITH SID = \' + @castId + \', TYPE = E;\'\nEXEC (@cmd);\n\n-- Assign roles to the new user\nDECLARE @role1 NVARCHAR(MAX) = N\'ALTER ROLE db_owner ADD MEMBER [\' + @name + \']\';\nEXEC (@role1);\n\n"@\n# Note: the string terminator must not have whitespace before it, therefore it is not indented.\n\nWrite-Host \$sqlCmd\n\n\$connectionString = "Server=tcp:\${sqlServerFqdn},1433;Initial Catalog=\${sqlDatabaseName};Authentication=Active Directory Default;"\n\n\$maxRetries = 5\n\$retryDelay = 60\n\$attempt = 0\n\$success = \$false\n\nwhile (-not \$success -and \$attempt -lt \$maxRetries) {\n \$attempt++\n Write-Host "Attempt \$attempt of \$maxRetries..."\n try {\n Invoke-Sqlcmd -ConnectionString \$connectionString -Query \$sqlCmd\n \$success = \$true\n Write-Host "SQL command succeeded on attempt \$attempt."\n } catch {\n Write-Host "Attempt \$attempt failed: \$_"\n if (\$attempt -lt \$maxRetries) {\n Write-Host "Retrying in \$retryDelay seconds..."\n Start-Sleep -Seconds \$retryDelay\n } else {\n throw\n }\n }\n}' + scriptContent: '\$sqlServerFqdn = "\$env:DBSERVER"\n\$sqlDatabaseName = "\$env:DBNAME"\n\$principalName = "\$env:PRINCIPALNAME"\n\$id = "\$env:ID"\n\n# Install SqlServer module - using specific version to avoid breaking changes in 22.4.5.1 (see https://github.com/microsoft/aspire/issues/9926)\nInstall-Module -Name SqlServer -RequiredVersion 22.3.0 -Force -AllowClobber -Scope CurrentUser\nImport-Module SqlServer\n\n\$sqlCmd = @"\nDECLARE @name SYSNAME = \'\$principalName\';\nDECLARE @id UNIQUEIDENTIFIER = \'\$id\';\n\n-- Convert the guid to the right type\nDECLARE @castId NVARCHAR(MAX) = CONVERT(VARCHAR(MAX), CONVERT (VARBINARY(16), @id), 1);\n\n-- Construct command: CREATE USER [@name] WITH SID = @castId, TYPE = E;\nDECLARE @cmd NVARCHAR(MAX) = N\'CREATE USER [\' + @name + \'] WITH SID = \' + @castId + \', TYPE = E;\'\nEXEC (@cmd);\n\n-- Assign roles to the new user\nDECLARE @role1 NVARCHAR(MAX) = N\'ALTER ROLE db_owner ADD MEMBER [\' + @name + \']\';\nEXEC (@role1);\n\n"@\n# Note: the string terminator must not have whitespace before it, therefore it is not indented.\n\nWrite-Host \$sqlCmd\n\n\$connectionString = "Server=tcp:\${sqlServerFqdn},1433;Initial Catalog=\${sqlDatabaseName};Authentication=Active Directory Default;"\n\n\$maxRetries = 5\n\$retryDelay = 60\n\$attempt = 0\n\$success = \$false\n\nwhile (-not \$success -and \$attempt -lt \$maxRetries) {\n \$attempt++\n Write-Host "Attempt \$attempt of \$maxRetries..."\n try {\n Invoke-Sqlcmd -ConnectionString \$connectionString -Query \$sqlCmd\n \$success = \$true\n Write-Host "SQL command succeeded on attempt \$attempt."\n } catch {\n Write-Host "Attempt \$attempt failed: \$_"\n if (\$attempt -lt \$maxRetries) {\n Write-Host "Retrying in \$retryDelay seconds..."\n Start-Sleep -Seconds \$retryDelay\n } else {\n throw\n }\n }\n}' storageAccountSettings: { storageAccountName: sql_store_outputs_name } diff --git a/tests/Aspire.Hosting.Azure.Tests/Snapshots/RoleAssignmentTests.SqlSupport.verified.bicep b/tests/Aspire.Hosting.Azure.Tests/Snapshots/RoleAssignmentTests.SqlSupport.verified.bicep index 1555f03fe38..7bf1c5a6fd1 100644 --- a/tests/Aspire.Hosting.Azure.Tests/Snapshots/RoleAssignmentTests.SqlSupport.verified.bicep +++ b/tests/Aspire.Hosting.Azure.Tests/Snapshots/RoleAssignmentTests.SqlSupport.verified.bicep @@ -56,6 +56,6 @@ resource script_sql_db 'Microsoft.Resources/deploymentScripts@2023-08-01' = { value: mi.properties.clientId } ] - scriptContent: '\$sqlServerFqdn = "\$env:DBSERVER"\n\$sqlDatabaseName = "\$env:DBNAME"\n\$principalName = "\$env:PRINCIPALNAME"\n\$id = "\$env:ID"\n\n# Install SqlServer module - using specific version to avoid breaking changes in 22.4.5.1 (see https://github.com/dotnet/aspire/issues/9926)\nInstall-Module -Name SqlServer -RequiredVersion 22.3.0 -Force -AllowClobber -Scope CurrentUser\nImport-Module SqlServer\n\n\$sqlCmd = @"\nDECLARE @name SYSNAME = \'\$principalName\';\nDECLARE @id UNIQUEIDENTIFIER = \'\$id\';\n\n-- Convert the guid to the right type\nDECLARE @castId NVARCHAR(MAX) = CONVERT(VARCHAR(MAX), CONVERT (VARBINARY(16), @id), 1);\n\n-- Construct command: CREATE USER [@name] WITH SID = @castId, TYPE = E;\nDECLARE @cmd NVARCHAR(MAX) = N\'CREATE USER [\' + @name + \'] WITH SID = \' + @castId + \', TYPE = E;\'\nEXEC (@cmd);\n\n-- Assign roles to the new user\nDECLARE @role1 NVARCHAR(MAX) = N\'ALTER ROLE db_owner ADD MEMBER [\' + @name + \']\';\nEXEC (@role1);\n\n"@\n# Note: the string terminator must not have whitespace before it, therefore it is not indented.\n\nWrite-Host \$sqlCmd\n\n\$connectionString = "Server=tcp:\${sqlServerFqdn},1433;Initial Catalog=\${sqlDatabaseName};Authentication=Active Directory Default;"\n\n\$maxRetries = 5\n\$retryDelay = 60\n\$attempt = 0\n\$success = \$false\n\nwhile (-not \$success -and \$attempt -lt \$maxRetries) {\n \$attempt++\n Write-Host "Attempt \$attempt of \$maxRetries..."\n try {\n Invoke-Sqlcmd -ConnectionString \$connectionString -Query \$sqlCmd\n \$success = \$true\n Write-Host "SQL command succeeded on attempt \$attempt."\n } catch {\n Write-Host "Attempt \$attempt failed: \$_"\n if (\$attempt -lt \$maxRetries) {\n Write-Host "Retrying in \$retryDelay seconds..."\n Start-Sleep -Seconds \$retryDelay\n } else {\n throw\n }\n }\n}' + scriptContent: '\$sqlServerFqdn = "\$env:DBSERVER"\n\$sqlDatabaseName = "\$env:DBNAME"\n\$principalName = "\$env:PRINCIPALNAME"\n\$id = "\$env:ID"\n\n# Install SqlServer module - using specific version to avoid breaking changes in 22.4.5.1 (see https://github.com/microsoft/aspire/issues/9926)\nInstall-Module -Name SqlServer -RequiredVersion 22.3.0 -Force -AllowClobber -Scope CurrentUser\nImport-Module SqlServer\n\n\$sqlCmd = @"\nDECLARE @name SYSNAME = \'\$principalName\';\nDECLARE @id UNIQUEIDENTIFIER = \'\$id\';\n\n-- Convert the guid to the right type\nDECLARE @castId NVARCHAR(MAX) = CONVERT(VARCHAR(MAX), CONVERT (VARBINARY(16), @id), 1);\n\n-- Construct command: CREATE USER [@name] WITH SID = @castId, TYPE = E;\nDECLARE @cmd NVARCHAR(MAX) = N\'CREATE USER [\' + @name + \'] WITH SID = \' + @castId + \', TYPE = E;\'\nEXEC (@cmd);\n\n-- Assign roles to the new user\nDECLARE @role1 NVARCHAR(MAX) = N\'ALTER ROLE db_owner ADD MEMBER [\' + @name + \']\';\nEXEC (@role1);\n\n"@\n# Note: the string terminator must not have whitespace before it, therefore it is not indented.\n\nWrite-Host \$sqlCmd\n\n\$connectionString = "Server=tcp:\${sqlServerFqdn},1433;Initial Catalog=\${sqlDatabaseName};Authentication=Active Directory Default;"\n\n\$maxRetries = 5\n\$retryDelay = 60\n\$attempt = 0\n\$success = \$false\n\nwhile (-not \$success -and \$attempt -lt \$maxRetries) {\n \$attempt++\n Write-Host "Attempt \$attempt of \$maxRetries..."\n try {\n Invoke-Sqlcmd -ConnectionString \$connectionString -Query \$sqlCmd\n \$success = \$true\n Write-Host "SQL command succeeded on attempt \$attempt."\n } catch {\n Write-Host "Attempt \$attempt failed: \$_"\n if (\$attempt -lt \$maxRetries) {\n Write-Host "Retrying in \$retryDelay seconds..."\n Start-Sleep -Seconds \$retryDelay\n } else {\n throw\n }\n }\n}' } } \ No newline at end of file diff --git a/tests/Aspire.Hosting.CodeGeneration.Java.Tests/AtsJavaCodeGeneratorTests.cs b/tests/Aspire.Hosting.CodeGeneration.Java.Tests/AtsJavaCodeGeneratorTests.cs index 6011fd89647..26a7865d92b 100644 --- a/tests/Aspire.Hosting.CodeGeneration.Java.Tests/AtsJavaCodeGeneratorTests.cs +++ b/tests/Aspire.Hosting.CodeGeneration.Java.Tests/AtsJavaCodeGeneratorTests.cs @@ -33,10 +33,12 @@ public async Task GenerateDistributedApplication_WithTestTypes_GeneratesCorrectO // Assert Assert.Contains("Aspire.java", files.Keys); - Assert.Contains("Transport.java", files.Keys); - Assert.Contains("Base.java", files.Keys); + Assert.Contains("AspireClient.java", files.Keys); + Assert.Contains("HandleWrapperBase.java", files.Keys); + Assert.Contains("TestRedisResource.java", files.Keys); + Assert.Contains("sources.txt", files.Keys); - await Verify(files["Aspire.java"], extension: "java") + await Verify(JoinGeneratedFiles(files), extension: "java") .UseFileName("AtsGeneratedAspire"); } @@ -151,6 +153,30 @@ public async Task Scanner_HostingAssembly_AddContainerCapability() await Verify(addContainer).UseFileName("HostingAddContainerCapability"); } + [Fact] + public void Scanner_HostingAssembly_FluentBuilderCapabilities_ReturnBuilder() + { + var capabilities = ScanCapabilitiesFromHostingAssembly(); + + var withReference = Assert.Single(capabilities, c => c.CapabilityId == "Aspire.Hosting/withReference"); + Assert.True(withReference.ReturnsBuilder); + + var waitFor = Assert.Single(capabilities, c => c.CapabilityId == "Aspire.Hosting/waitFor"); + Assert.True(waitFor.ReturnsBuilder); + } + + [Fact] + public void GeneratedCode_HostingAssembly_FluentBuilderMethods_ReturnConcreteBuilderType() + { + var atsContext = CreateContextFromBothAssemblies(); + + var files = _generator.GenerateDistributedApplication(atsContext); + var containerResourceJava = files["ContainerResource.java"]; + + Assert.Contains("public ContainerResource withReference(IResource source, WithReferenceOptions options)", containerResourceJava); + Assert.Contains("public ContainerResource waitFor(IResource dependency)", containerResourceJava); + } + [Fact] public void RuntimeType_ContainerResource_IsNotInterface() { @@ -211,13 +237,13 @@ public async Task TwoPassScanning_GeneratesWithEnvironmentOnTestRedisBuilder() // Generate Java var files = _generator.GenerateDistributedApplication(atsContext); - var aspireJava = files["Aspire.java"]; + var testRedisJava = files["TestRedisResource.java"]; // Verify withEnvironment appears (method should exist for resources that support it) - Assert.Contains("withEnvironment", aspireJava); + Assert.Contains("withEnvironment", testRedisJava); // Snapshot for detailed verification - await Verify(aspireJava, extension: "java") + await Verify(JoinGeneratedFiles(files), extension: "java") .UseFileName("TwoPassScanningGeneratedAspire"); } @@ -228,11 +254,12 @@ public void GeneratedCode_UsesCamelCaseMethodNames() var atsContext = CreateContextFromBothAssemblies(); var files = _generator.GenerateDistributedApplication(atsContext); - var aspireJava = files["Aspire.java"]; + var builderJava = files["IDistributedApplicationBuilder.java"]; + var testRedisJava = files["TestRedisResource.java"]; // Java uses camelCase for methods - Assert.Contains("addContainer", aspireJava); - Assert.Contains("withEnvironment", aspireJava); + Assert.Contains("addContainer", builderJava); + Assert.Contains("withEnvironment", testRedisJava); } [Fact] @@ -242,9 +269,9 @@ public void GeneratedCode_HasCreateBuilderMethod() var atsContext = CreateContextFromBothAssemblies(); var files = _generator.GenerateDistributedApplication(atsContext); - var aspireJava = files["Aspire.java"]; + var distributedApplicationJava = files["DistributedApplication.java"]; - Assert.Contains("createBuilder", aspireJava); + Assert.Contains("createBuilder", distributedApplicationJava); } [Fact] @@ -259,6 +286,15 @@ public void GeneratedCode_HasPublicAspireClass() Assert.Contains("public class Aspire", aspireJava); } + private static string JoinGeneratedFiles(Dictionary files) + { + return string.Join( + "\n", + files + .OrderBy(kvp => kvp.Key, StringComparer.Ordinal) + .Select(kvp => $"// ===== {kvp.Key} =====\n{kvp.Value}")); + } + private static List ScanCapabilitiesFromTestAssembly() { var testAssembly = LoadTestAssembly(); diff --git a/tests/Aspire.Hosting.CodeGeneration.Java.Tests/Snapshots/AtsGeneratedAspire.verified.java b/tests/Aspire.Hosting.CodeGeneration.Java.Tests/Snapshots/AtsGeneratedAspire.verified.java index b24fe84b254..c6cd4dedcee 100644 --- a/tests/Aspire.Hosting.CodeGeneration.Java.Tests/Snapshots/AtsGeneratedAspire.verified.java +++ b/tests/Aspire.Hosting.CodeGeneration.Java.Tests/Snapshots/AtsGeneratedAspire.verified.java @@ -1,144 +1,1169 @@ -// Aspire.java - Capability-based Aspire SDK -// GENERATED CODE - DO NOT EDIT +// ===== Aspire.java ===== +// Aspire.java - GENERATED CODE - DO NOT EDIT package aspire; import java.util.*; import java.util.function.*; -// ============================================================================ -// Enums -// ============================================================================ +/** Main entry point for Aspire SDK. */ +public class Aspire { + /** Connect to the AppHost server. */ + public static AspireClient connect() throws Exception { + BaseRegistrations.ensureRegistered(); + AspireRegistrations.ensureRegistered(); + String socketPath = System.getenv("REMOTE_APP_HOST_SOCKET_PATH"); + if (socketPath == null || socketPath.isEmpty()) { + throw new RuntimeException("REMOTE_APP_HOST_SOCKET_PATH environment variable not set. Run this application using `aspire run`."); + } + AspireClient client = new AspireClient(socketPath); + client.connect(); + client.onDisconnect(() -> System.exit(1)); + return client; + } -/** TestPersistenceMode enum. */ -enum TestPersistenceMode { - NONE("None"), - VOLUME("Volume"), - BIND("Bind"); + /** Create a new distributed application builder. */ + public static IDistributedApplicationBuilder createBuilder(CreateBuilderOptions options) throws Exception { + AspireClient client = connect(); + Map resolvedOptions = new HashMap<>(); + if (options != null) { + resolvedOptions.putAll(options.toMap()); + } + if (resolvedOptions.get("Args") == null) { + // Note: Java doesn't have easy access to command line args from here + resolvedOptions.put("Args", new String[0]); + } + if (resolvedOptions.get("ProjectDirectory") == null) { + resolvedOptions.put("ProjectDirectory", System.getProperty("user.dir")); + } + if (resolvedOptions.get("AppHostFilePath") == null) { + String appHostFilePath = System.getenv("ASPIRE_APPHOST_FILEPATH"); + if (appHostFilePath != null && !appHostFilePath.isEmpty()) { + resolvedOptions.put("AppHostFilePath", appHostFilePath); + } + } + Map args = new HashMap<>(); + args.put("options", resolvedOptions); + return (IDistributedApplicationBuilder) client.invokeCapability("Aspire.Hosting/createBuilderWithOptions", args); + } +} - private final String value; +// ===== AspireAction0.java ===== +// AspireAction0.java - GENERATED CODE - DO NOT EDIT - TestPersistenceMode(String value) { - this.value = value; +package aspire; + +import java.util.*; + +@FunctionalInterface +public interface AspireAction0 { + void invoke(); +} + +// ===== AspireAction1.java ===== +// AspireAction1.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; + +@FunctionalInterface +public interface AspireAction1 { + void invoke(T1 arg1); +} + +// ===== AspireAction2.java ===== +// AspireAction2.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; + +@FunctionalInterface +public interface AspireAction2 { + void invoke(T1 arg1, T2 arg2); +} + +// ===== AspireAction3.java ===== +// AspireAction3.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; + +@FunctionalInterface +public interface AspireAction3 { + void invoke(T1 arg1, T2 arg2, T3 arg3); +} + +// ===== AspireAction4.java ===== +// AspireAction4.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; + +@FunctionalInterface +public interface AspireAction4 { + void invoke(T1 arg1, T2 arg2, T3 arg3, T4 arg4); +} + +// ===== AspireClient.java ===== +// AspireClient.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.io.*; +import java.net.*; +import java.nio.charset.StandardCharsets; +import java.util.*; +import java.util.concurrent.*; +import java.util.concurrent.atomic.*; +import java.util.function.*; + +/** + * AspireClient handles JSON-RPC communication with the AppHost server. + */ +public class AspireClient { + private static final boolean DEBUG = System.getenv("ASPIRE_DEBUG") != null; + + private final String socketPath; + private OutputStream outputStream; + private InputStream inputStream; + private final AtomicInteger requestId = new AtomicInteger(0); + private final Map> callbacks = new ConcurrentHashMap<>(); + private final Map> cancellations = new ConcurrentHashMap<>(); + private Runnable disconnectHandler; + private volatile boolean connected = false; + + // Handle wrapper factory registry + private static final Map> handleWrappers = new ConcurrentHashMap<>(); + + public static void registerHandleWrapper(String typeId, BiFunction factory) { + handleWrappers.put(typeId, factory); + } + + public AspireClient(String socketPath) { + this.socketPath = socketPath; + } + + public void connect() throws IOException { + debug("Connecting to AppHost server at " + socketPath); + + if (isWindows()) { + connectWindowsNamedPipe(); + } else { + connectUnixSocket(); + } + + connected = true; + debug("Connected successfully"); + } + + private boolean isWindows() { + return System.getProperty("os.name").toLowerCase().contains("win"); + } + + private void connectWindowsNamedPipe() throws IOException { + // Extract just the filename from the socket path for the named pipe + String pipeName = new java.io.File(socketPath).getName(); + String pipePath = "\\\\.\\pipe\\" + pipeName; + debug("Opening Windows named pipe: " + pipePath); + + // Use RandomAccessFile to open the named pipe + RandomAccessFile pipe = new RandomAccessFile(pipePath, "rw"); + + // Create streams from the RandomAccessFile + FileDescriptor fd = pipe.getFD(); + inputStream = new FileInputStream(fd); + outputStream = new FileOutputStream(fd); + + debug("Named pipe opened successfully"); + } + + private void connectUnixSocket() throws IOException { + // Use Java 16+ Unix domain socket support + debug("Opening Unix domain socket: " + socketPath); + var address = java.net.UnixDomainSocketAddress.of(socketPath); + var channel = java.nio.channels.SocketChannel.open(address); + + // Create streams from the channel + inputStream = java.nio.channels.Channels.newInputStream(channel); + outputStream = java.nio.channels.Channels.newOutputStream(channel); + + debug("Unix domain socket opened successfully"); + } + + public void onDisconnect(Runnable handler) { + this.disconnectHandler = handler; + } + + public Object invokeCapability(String capabilityId, Map args) { + int id = requestId.incrementAndGet(); + + Map params = new HashMap<>(); + params.put("capabilityId", capabilityId); + params.put("args", args); + + Map request = new HashMap<>(); + request.put("jsonrpc", "2.0"); + request.put("id", id); + request.put("method", "invokeCapability"); + request.put("params", params); + + debug("Sending request invokeCapability with id=" + id); + + try { + sendMessage(request); + return readResponse(id); + } catch (IOException e) { + handleDisconnect(); + throw new RuntimeException("Failed to invoke capability: " + e.getMessage(), e); + } } - public String getValue() { return value; } + private void sendMessage(Map message) throws IOException { + String json = toJson(message); + byte[] content = json.getBytes(StandardCharsets.UTF_8); + String header = "Content-Length: " + content.length + "\r\n\r\n"; + + debug("Writing message: " + message.get("method") + " (id=" + message.get("id") + ")"); + + synchronized (outputStream) { + outputStream.write(header.getBytes(StandardCharsets.UTF_8)); + outputStream.write(content); + outputStream.flush(); + } + } - public static TestPersistenceMode fromValue(String value) { - for (TestPersistenceMode e : values()) { - if (e.value.equals(value)) return e; + private Object readResponse(int expectedId) throws IOException { + while (true) { + Map message = readMessage(); + + if (message.containsKey("method")) { + // This is a request from server (callback invocation) + handleServerRequest(message); + continue; + } + + // This is a response + Object idObj = message.get("id"); + int responseId = idObj instanceof Number ? ((Number) idObj).intValue() : Integer.parseInt(idObj.toString()); + + if (responseId != expectedId) { + debug("Received response for different id: " + responseId + " (expected " + expectedId + ")"); + continue; + } + + if (message.containsKey("error")) { + @SuppressWarnings("unchecked") + Map error = (Map) message.get("error"); + String code = String.valueOf(error.get("code")); + String errorMessage = String.valueOf(error.get("message")); + Object data = error.get("data"); + throw new CapabilityError(code, errorMessage, data); + } + + Object result = message.get("result"); + return unwrapResult(result); + } + } + + @SuppressWarnings("unchecked") + private Map readMessage() throws IOException { + // Read headers + StringBuilder headerBuilder = new StringBuilder(); + int contentLength = -1; + + while (true) { + String line = readLine(); + if (line.isEmpty()) { + break; + } + if (line.startsWith("Content-Length:")) { + contentLength = Integer.parseInt(line.substring(15).trim()); + } + } + + if (contentLength < 0) { + throw new IOException("No Content-Length header found"); + } + + // Read body + byte[] body = new byte[contentLength]; + int totalRead = 0; + while (totalRead < contentLength) { + int read = inputStream.read(body, totalRead, contentLength - totalRead); + if (read < 0) { + throw new IOException("Unexpected end of stream"); + } + totalRead += read; + } + + String json = new String(body, StandardCharsets.UTF_8); + debug("Received: " + json.substring(0, Math.min(200, json.length())) + "..."); + + return (Map) parseJson(json); + } + + private String readLine() throws IOException { + StringBuilder sb = new StringBuilder(); + int ch; + while ((ch = inputStream.read()) != -1) { + if (ch == '\r') { + int next = inputStream.read(); + if (next == '\n') { + break; + } + sb.append((char) ch); + if (next != -1) sb.append((char) next); + } else if (ch == '\n') { + break; + } else { + sb.append((char) ch); + } + } + return sb.toString(); + } + + @SuppressWarnings("unchecked") + private void handleServerRequest(Map request) throws IOException { + String method = (String) request.get("method"); + Object idObj = request.get("id"); + Map params = (Map) request.get("params"); + + debug("Received server request: " + method); + + Object result = null; + Map error = null; + + try { + if ("invokeCallback".equals(method)) { + String callbackId = (String) params.get("callbackId"); + List args = (List) params.get("args"); + + Function callback = callbacks.get(callbackId); + if (callback != null) { + Object[] unwrappedArgs = args.stream() + .map(this::unwrapResult) + .toArray(); + result = awaitValue(callback.apply(unwrappedArgs)); + } else { + error = createError(-32601, "Callback not found: " + callbackId); + } + } else if ("cancel".equals(method)) { + String cancellationId = (String) params.get("cancellationId"); + Consumer handler = cancellations.get(cancellationId); + if (handler != null) { + handler.accept(null); + } + result = true; + } else { + error = createError(-32601, "Unknown method: " + method); + } + } catch (Exception e) { + error = createError(-32603, e.getMessage()); + } + + // Send response + Map response = new HashMap<>(); + response.put("jsonrpc", "2.0"); + response.put("id", idObj); + if (error != null) { + response.put("error", error); + } else { + response.put("result", serializeValue(result)); + } + + sendMessage(response); + } + + private Map createError(int code, String message) { + Map error = new HashMap<>(); + error.put("code", code); + error.put("message", message); + return error; + } + + @SuppressWarnings("unchecked") + private Object unwrapResult(Object value) { + if (value == null) { + return null; + } + + if (value instanceof Map) { + Map map = (Map) value; + + // Check for handle + if (map.containsKey("$handle")) { + String handleId = (String) map.get("$handle"); + String typeId = (String) map.get("$type"); + Handle handle = new Handle(handleId, typeId); + + BiFunction factory = handleWrappers.get(typeId); + if (factory != null) { + return factory.apply(handle, this); + } + return handle; + } + + // Check for error + if (map.containsKey("$error")) { + Map errorData = (Map) map.get("$error"); + String code = String.valueOf(errorData.get("code")); + String message = String.valueOf(errorData.get("message")); + throw new CapabilityError(code, message, errorData.get("data")); + } + + // Recursively unwrap map values + Map result = new HashMap<>(); + for (Map.Entry entry : map.entrySet()) { + result.put(entry.getKey(), unwrapResult(entry.getValue())); + } + return result; + } + + if (value instanceof List) { + List list = (List) value; + List result = new ArrayList<>(); + for (Object item : list) { + result.add(unwrapResult(item)); + } + return result; + } + + return value; + } + + private void handleDisconnect() { + connected = false; + if (disconnectHandler != null) { + disconnectHandler.run(); + } + } + + public String registerCallback(Function callback) { + String id = UUID.randomUUID().toString(); + callbacks.put(id, callback); + return id; + } + + public String registerCancellation(CancellationToken token) { + String id = UUID.randomUUID().toString(); + cancellations.put(id, v -> token.cancel()); + return id; + } + + public static Object awaitValue(Object value) { + if (value instanceof CompletionStage stage) { + return stage.toCompletableFuture().join(); + } + return value; + } + + // Simple JSON serialization (no external dependencies) + public static Object serializeValue(Object value) { + if (value == null) { + return null; + } + if (value instanceof Handle) { + return ((Handle) value).toJson(); + } + if (value instanceof HandleWrapperBase) { + return ((HandleWrapperBase) value).getHandle().toJson(); + } + if (value instanceof ReferenceExpression) { + return ((ReferenceExpression) value).toJson(); + } + if (value instanceof AspireUnion union) { + return serializeValue(union.getValue()); + } + if (value instanceof Map) { + @SuppressWarnings("unchecked") + Map map = (Map) value; + Map result = new HashMap<>(); + for (Map.Entry entry : map.entrySet()) { + result.put(entry.getKey(), serializeValue(entry.getValue())); + } + return result; + } + if (value instanceof List) { + @SuppressWarnings("unchecked") + List list = (List) value; + List result = new ArrayList<>(); + for (Object item : list) { + result.add(serializeValue(item)); + } + return result; + } + if (value instanceof Object[]) { + Object[] array = (Object[]) value; + List result = new ArrayList<>(); + for (Object item : array) { + result.add(serializeValue(item)); + } + return result; + } + if (value instanceof WireValueEnum wireValueEnum) { + return wireValueEnum.getValue(); + } + if (value instanceof Enum) { + return ((Enum) value).name(); + } + return value; + } + + // Simple JSON encoding + private String toJson(Object value) { + if (value == null) { + return "null"; + } + if (value instanceof String) { + return "\"" + escapeJson((String) value) + "\""; + } + if (value instanceof Number || value instanceof Boolean) { + return value.toString(); + } + if (value instanceof Map) { + @SuppressWarnings("unchecked") + Map map = (Map) value; + StringBuilder sb = new StringBuilder("{"); + boolean first = true; + for (Map.Entry entry : map.entrySet()) { + if (!first) sb.append(","); + first = false; + sb.append("\"").append(escapeJson(entry.getKey())).append("\":"); + sb.append(toJson(entry.getValue())); + } + sb.append("}"); + return sb.toString(); + } + if (value instanceof List) { + @SuppressWarnings("unchecked") + List list = (List) value; + StringBuilder sb = new StringBuilder("["); + boolean first = true; + for (Object item : list) { + if (!first) sb.append(","); + first = false; + sb.append(toJson(item)); + } + sb.append("]"); + return sb.toString(); + } + if (value instanceof Object[]) { + Object[] array = (Object[]) value; + StringBuilder sb = new StringBuilder("["); + boolean first = true; + for (Object item : array) { + if (!first) sb.append(","); + first = false; + sb.append(toJson(item)); + } + sb.append("]"); + return sb.toString(); + } + return "\"" + escapeJson(value.toString()) + "\""; + } + + private String escapeJson(String s) { + StringBuilder sb = new StringBuilder(); + for (char c : s.toCharArray()) { + switch (c) { + case '"': sb.append("\\\""); break; + case '\\': sb.append("\\\\"); break; + case '\b': sb.append("\\b"); break; + case '\f': sb.append("\\f"); break; + case '\n': sb.append("\\n"); break; + case '\r': sb.append("\\r"); break; + case '\t': sb.append("\\t"); break; + default: + if (c < ' ') { + sb.append(String.format("\\u%04x", (int) c)); + } else { + sb.append(c); + } + } + } + return sb.toString(); + } + + // Simple JSON parsing + @SuppressWarnings("unchecked") + private Object parseJson(String json) { + return new JsonParser(json).parse(); + } + + private static class JsonParser { + private final String json; + private int pos = 0; + + JsonParser(String json) { + this.json = json; + } + + Object parse() { + skipWhitespace(); + return parseValue(); + } + + private Object parseValue() { + skipWhitespace(); + char c = peek(); + if (c == '{') return parseObject(); + if (c == '[') return parseArray(); + if (c == '"') return parseString(); + if (c == 't' || c == 'f') return parseBoolean(); + if (c == 'n') return parseNull(); + if (c == '-' || Character.isDigit(c)) return parseNumber(); + throw new RuntimeException("Unexpected character: " + c + " at position " + pos); + } + + private Map parseObject() { + expect('{'); + Map map = new LinkedHashMap<>(); + skipWhitespace(); + if (peek() != '}') { + do { + skipWhitespace(); + String key = parseString(); + skipWhitespace(); + expect(':'); + Object value = parseValue(); + map.put(key, value); + skipWhitespace(); + } while (tryConsume(',')); + } + expect('}'); + return map; + } + + private List parseArray() { + expect('['); + List list = new ArrayList<>(); + skipWhitespace(); + if (peek() != ']') { + do { + list.add(parseValue()); + skipWhitespace(); + } while (tryConsume(',')); + } + expect(']'); + return list; + } + + private String parseString() { + expect('"'); + StringBuilder sb = new StringBuilder(); + while (pos < json.length()) { + char c = json.charAt(pos++); + if (c == '"') return sb.toString(); + if (c == '\\') { + c = json.charAt(pos++); + switch (c) { + case '"': case '\\': case '/': sb.append(c); break; + case 'b': sb.append('\b'); break; + case 'f': sb.append('\f'); break; + case 'n': sb.append('\n'); break; + case 'r': sb.append('\r'); break; + case 't': sb.append('\t'); break; + case 'u': + String hex = json.substring(pos, pos + 4); + sb.append((char) Integer.parseInt(hex, 16)); + pos += 4; + break; + } + } else { + sb.append(c); + } + } + throw new RuntimeException("Unterminated string"); + } + + private Number parseNumber() { + int start = pos; + if (peek() == '-') pos++; + while (pos < json.length() && Character.isDigit(json.charAt(pos))) pos++; + if (pos < json.length() && json.charAt(pos) == '.') { + pos++; + while (pos < json.length() && Character.isDigit(json.charAt(pos))) pos++; + } + if (pos < json.length() && (json.charAt(pos) == 'e' || json.charAt(pos) == 'E')) { + pos++; + if (pos < json.length() && (json.charAt(pos) == '+' || json.charAt(pos) == '-')) pos++; + while (pos < json.length() && Character.isDigit(json.charAt(pos))) pos++; + } + String numStr = json.substring(start, pos); + if (numStr.contains(".") || numStr.contains("e") || numStr.contains("E")) { + return Double.parseDouble(numStr); + } + long l = Long.parseLong(numStr); + if (l >= Integer.MIN_VALUE && l <= Integer.MAX_VALUE) { + return (int) l; + } + return l; + } + + private Boolean parseBoolean() { + if (json.startsWith("true", pos)) { + pos += 4; + return true; + } + if (json.startsWith("false", pos)) { + pos += 5; + return false; + } + throw new RuntimeException("Expected boolean at position " + pos); + } + + private Object parseNull() { + if (json.startsWith("null", pos)) { + pos += 4; + return null; + } + throw new RuntimeException("Expected null at position " + pos); + } + + private void skipWhitespace() { + while (pos < json.length() && Character.isWhitespace(json.charAt(pos))) pos++; + } + + private char peek() { + return pos < json.length() ? json.charAt(pos) : '\0'; + } + + private void expect(char c) { + skipWhitespace(); + if (pos >= json.length() || json.charAt(pos) != c) { + throw new RuntimeException("Expected '" + c + "' at position " + pos); + } + pos++; + } + + private boolean tryConsume(char c) { + skipWhitespace(); + if (pos < json.length() && json.charAt(pos) == c) { + pos++; + return true; + } + return false; + } + } + + private void debug(String message) { + if (DEBUG) { + System.err.println("[Java ATS] " + message); } - throw new IllegalArgumentException("Unknown value: " + value); } } -/** TestResourceStatus enum. */ -enum TestResourceStatus { - PENDING("Pending"), - RUNNING("Running"), - STOPPED("Stopped"), - FAILED("Failed"); +// ===== AspireDict.java ===== +// AspireDict.java - GENERATED CODE - DO NOT EDIT - private final String value; +package aspire; - TestResourceStatus(String value) { +import java.util.*; + +/** + * AspireDict is a handle-backed dictionary with lazy handle resolution. + */ +public class AspireDict extends HandleWrapperBase { + private final String getterCapabilityId; + private Handle resolvedHandle; + + AspireDict(Handle handle, AspireClient client) { + super(handle, client); + this.getterCapabilityId = null; + this.resolvedHandle = handle; + } + + AspireDict(Handle contextHandle, AspireClient client, String getterCapabilityId) { + super(contextHandle, client); + this.getterCapabilityId = getterCapabilityId; + this.resolvedHandle = null; + } + + private Handle ensureHandle() { + if (resolvedHandle != null) { + return resolvedHandle; + } + if (getterCapabilityId != null) { + Map args = new HashMap<>(); + args.put("context", getHandle().toJson()); + Object result = getClient().invokeCapability(getterCapabilityId, args); + if (result instanceof Handle handle) { + resolvedHandle = handle; + } + } + if (resolvedHandle == null) { + resolvedHandle = getHandle(); + } + return resolvedHandle; + } +} + +// ===== AspireFunc0.java ===== +// AspireFunc0.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; + +@FunctionalInterface +public interface AspireFunc0 { + R invoke(); +} + +// ===== AspireFunc1.java ===== +// AspireFunc1.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; + +@FunctionalInterface +public interface AspireFunc1 { + R invoke(T1 arg1); +} + +// ===== AspireFunc2.java ===== +// AspireFunc2.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; + +@FunctionalInterface +public interface AspireFunc2 { + R invoke(T1 arg1, T2 arg2); +} + +// ===== AspireFunc3.java ===== +// AspireFunc3.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; + +@FunctionalInterface +public interface AspireFunc3 { + R invoke(T1 arg1, T2 arg2, T3 arg3); +} + +// ===== AspireFunc4.java ===== +// AspireFunc4.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; + +@FunctionalInterface +public interface AspireFunc4 { + R invoke(T1 arg1, T2 arg2, T3 arg3, T4 arg4); +} + +// ===== AspireList.java ===== +// AspireList.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; + +/** + * AspireList is a handle-backed list with lazy handle resolution. + */ +public class AspireList extends HandleWrapperBase { + private final String getterCapabilityId; + private Handle resolvedHandle; + + AspireList(Handle handle, AspireClient client) { + super(handle, client); + this.getterCapabilityId = null; + this.resolvedHandle = handle; + } + + AspireList(Handle contextHandle, AspireClient client, String getterCapabilityId) { + super(contextHandle, client); + this.getterCapabilityId = getterCapabilityId; + this.resolvedHandle = null; + } + + private Handle ensureHandle() { + if (resolvedHandle != null) { + return resolvedHandle; + } + if (getterCapabilityId != null) { + Map args = new HashMap<>(); + args.put("context", getHandle().toJson()); + Object result = getClient().invokeCapability(getterCapabilityId, args); + if (result instanceof Handle handle) { + resolvedHandle = handle; + } + } + if (resolvedHandle == null) { + resolvedHandle = getHandle(); + } + return resolvedHandle; + } +} + +// ===== AspireRegistrations.java ===== +// AspireRegistrations.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Static initializer to register handle wrappers. */ +public class AspireRegistrations { + static { + AspireClient.registerHandleWrapper("Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestCallbackContext", (h, c) -> new TestCallbackContext(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestResourceContext", (h, c) -> new TestResourceContext(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestEnvironmentContext", (h, c) -> new TestEnvironmentContext(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestCollectionContext", (h, c) -> new TestCollectionContext(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestRedisResource", (h, c) -> new TestRedisResource(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestDatabaseResource", (h, c) -> new TestDatabaseResource(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource", (h, c) -> new IResource(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString", (h, c) -> new IResourceWithConnectionString(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestVaultResource", (h, c) -> new TestVaultResource(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.ITestVaultResource", (h, c) -> new ITestVaultResource(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder", (h, c) -> new IDistributedApplicationBuilder(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment", (h, c) -> new IResourceWithEnvironment(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/List", (h, c) -> new AspireList(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Dict", (h, c) -> new AspireDict(h, c)); + } + + static void ensureRegistered() { + // Called to trigger static initializer + } +} + +// ===== AspireUnion.java ===== +// AspireUnion.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; + +/** + * Represents a runtime union value for generated Java APIs. + */ +public final class AspireUnion { + private final Object value; + + private AspireUnion(Object value) { this.value = value; } - public String getValue() { return value; } + static AspireUnion of(Object value) { + return value instanceof AspireUnion union ? union : new AspireUnion(value); + } - public static TestResourceStatus fromValue(String value) { - for (TestResourceStatus e : values()) { - if (e.value.equals(value)) return e; + static AspireUnion fromValue(Object value) { + return of(value); + } + + Object getValue() { + return value; + } + + boolean is(Class type) { + return value != null && type.isInstance(value); + } + + T getValueAs(Class type) { + if (value == null) { + return null; } - throw new IllegalArgumentException("Unknown value: " + value); + if (!type.isInstance(value)) { + throw new IllegalStateException("Union value is of type " + value.getClass().getName() + ", not " + type.getName()); + } + return type.cast(value); + } + + @Override + public String toString() { + return "AspireUnion{" + value + "}"; } } -// ============================================================================ -// DTOs -// ============================================================================ +// ===== BaseRegistrations.java ===== +// BaseRegistrations.java - GENERATED CODE - DO NOT EDIT -/** TestConfigDto DTO. */ -class TestConfigDto { - private String name; - private double port; - private boolean enabled; - private String optionalField; +package aspire; - public String getName() { return name; } - public void setName(String value) { this.name = value; } - public double getPort() { return port; } - public void setPort(double value) { this.port = value; } - public boolean getEnabled() { return enabled; } - public void setEnabled(boolean value) { this.enabled = value; } - public String getOptionalField() { return optionalField; } - public void setOptionalField(String value) { this.optionalField = value; } +import java.util.*; - public Map toMap() { - Map map = new HashMap<>(); - map.put("Name", AspireClient.serializeValue(name)); - map.put("Port", AspireClient.serializeValue(port)); - map.put("Enabled", AspireClient.serializeValue(enabled)); - map.put("OptionalField", AspireClient.serializeValue(optionalField)); - return map; +/** + * Registers runtime-owned wrappers defined in Base.java. + */ +public final class BaseRegistrations { + private BaseRegistrations() { + } + + static { + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression", ReferenceExpression::new); + } + + static void ensureRegistered() { } } -/** TestNestedDto DTO. */ -class TestNestedDto { - private String id; - private TestConfigDto config; - private AspireList tags; - private AspireDict counts; +// ===== CancellationToken.java ===== +// CancellationToken.java - GENERATED CODE - DO NOT EDIT - public String getId() { return id; } - public void setId(String value) { this.id = value; } - public TestConfigDto getConfig() { return config; } - public void setConfig(TestConfigDto value) { this.config = value; } - public AspireList getTags() { return tags; } - public void setTags(AspireList value) { this.tags = value; } - public AspireDict getCounts() { return counts; } - public void setCounts(AspireDict value) { this.counts = value; } +package aspire; - public Map toMap() { - Map map = new HashMap<>(); - map.put("Id", AspireClient.serializeValue(id)); - map.put("Config", AspireClient.serializeValue(config)); - map.put("Tags", AspireClient.serializeValue(tags)); - map.put("Counts", AspireClient.serializeValue(counts)); - return map; +import java.io.*; +import java.net.*; +import java.nio.charset.StandardCharsets; +import java.util.*; +import java.util.concurrent.*; +import java.util.concurrent.atomic.*; +import java.util.function.*; + +/** + * CancellationToken for cancelling operations. + */ +public class CancellationToken { + private volatile boolean cancelled = false; + private final List listeners = new CopyOnWriteArrayList<>(); + + void cancel() { + cancelled = true; + for (Runnable listener : listeners) { + listener.run(); + } + } + + boolean isCancelled() { return cancelled; } + + void onCancel(Runnable listener) { + listeners.add(listener); + if (cancelled) { + listener.run(); + } } } -/** TestDeeplyNestedDto DTO. */ -class TestDeeplyNestedDto { - private AspireDict> nestedData; - private AspireDict[] metadataArray; +// ===== CapabilityError.java ===== +// CapabilityError.java - GENERATED CODE - DO NOT EDIT - public AspireDict> getNestedData() { return nestedData; } - public void setNestedData(AspireDict> value) { this.nestedData = value; } - public AspireDict[] getMetadataArray() { return metadataArray; } - public void setMetadataArray(AspireDict[] value) { this.metadataArray = value; } +package aspire; - public Map toMap() { - Map map = new HashMap<>(); - map.put("NestedData", AspireClient.serializeValue(nestedData)); - map.put("MetadataArray", AspireClient.serializeValue(metadataArray)); - return map; +import java.io.*; +import java.net.*; +import java.nio.charset.StandardCharsets; +import java.util.*; +import java.util.concurrent.*; +import java.util.concurrent.atomic.*; +import java.util.function.*; + +/** + * CapabilityError represents an error from a capability invocation. + */ +public class CapabilityError extends RuntimeException { + private final String code; + private final Object data; + + CapabilityError(String code, String message, Object data) { + super(message); + this.code = code; + this.data = data; + } + + String getCode() { return code; } + Object getData() { return data; } +} + +// ===== Handle.java ===== +// Handle.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.io.*; +import java.net.*; +import java.nio.charset.StandardCharsets; +import java.util.*; +import java.util.concurrent.*; +import java.util.concurrent.atomic.*; +import java.util.function.*; + +/** + * Handle represents a remote object reference. + */ +public class Handle { + private final String id; + private final String typeId; + + Handle(String id, String typeId) { + this.id = id; + this.typeId = typeId; + } + + String getId() { return id; } + String getTypeId() { return typeId; } + + Map toJson() { + Map result = new HashMap<>(); + result.put("$handle", id); + result.put("$type", typeId); + return result; + } + + @Override + public String toString() { + return "Handle{id='" + id + "', typeId='" + typeId + "'}"; + } +} + +// ===== HandleWrapperBase.java ===== +// HandleWrapperBase.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; + +/** + * HandleWrapperBase is the base class for all handle wrappers. + */ +public class HandleWrapperBase { + private final Handle handle; + private final AspireClient client; + + HandleWrapperBase(Handle handle, AspireClient client) { + this.handle = handle; + this.client = client; + } + + Handle getHandle() { + return handle; + } + + AspireClient getClient() { + return client; } } -// ============================================================================ -// Handle Wrappers -// ============================================================================ +// ===== IDistributedApplicationBuilder.java ===== +// IDistributedApplicationBuilder.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; /** Wrapper for Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder. */ -class IDistributedApplicationBuilder extends HandleWrapperBase { +public class IDistributedApplicationBuilder extends HandleWrapperBase { IDistributedApplicationBuilder(Handle handle, AspireClient client) { super(handle, client); } + public TestRedisResource addTestRedis(String name) { + return addTestRedis(name, null); + } + /** Adds a test Redis resource */ public TestRedisResource addTestRedis(String name, Double port) { Map reqArgs = new HashMap<>(); @@ -160,40 +1185,224 @@ public TestVaultResource addTestVault(String name) { } +// ===== IResource.java ===== +// IResource.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + /** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource. */ -class IResource extends ResourceBuilderBase { +public class IResource extends ResourceBuilderBase { IResource(Handle handle, AspireClient client) { super(handle, client); } } +// ===== IResourceWithConnectionString.java ===== +// IResourceWithConnectionString.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + /** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString. */ -class IResourceWithConnectionString extends ResourceBuilderBase { +public class IResourceWithConnectionString extends ResourceBuilderBase { IResourceWithConnectionString(Handle handle, AspireClient client) { super(handle, client); } } +// ===== IResourceWithEnvironment.java ===== +// IResourceWithEnvironment.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + /** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment. */ -class IResourceWithEnvironment extends HandleWrapperBase { +public class IResourceWithEnvironment extends HandleWrapperBase { IResourceWithEnvironment(Handle handle, AspireClient client) { super(handle, client); } } +// ===== ITestVaultResource.java ===== +// ITestVaultResource.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + /** Wrapper for Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.ITestVaultResource. */ -class ITestVaultResource extends ResourceBuilderBase { +public class ITestVaultResource extends ResourceBuilderBase { ITestVaultResource(Handle handle, AspireClient client) { super(handle, client); } } +// ===== ReferenceExpression.java ===== +// ReferenceExpression.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; + +/** + * ReferenceExpression represents a reference expression. + * Supports value mode (format + value providers), conditional mode, and handle mode. + */ +public class ReferenceExpression { + private final String format; + private final Object[] valueProviders; + private final Object condition; + private final ReferenceExpression whenTrue; + private final ReferenceExpression whenFalse; + private final String matchValue; + private final Handle handle; + private final AspireClient client; + + ReferenceExpression(String format, Object... valueProviders) { + this.format = format; + this.valueProviders = valueProviders; + this.condition = null; + this.whenTrue = null; + this.whenFalse = null; + this.matchValue = null; + this.handle = null; + this.client = null; + } + + private ReferenceExpression(Object condition, String matchValue, ReferenceExpression whenTrue, ReferenceExpression whenFalse) { + this.format = null; + this.valueProviders = null; + this.condition = condition; + this.whenTrue = whenTrue; + this.whenFalse = whenFalse; + this.matchValue = matchValue != null ? matchValue : "True"; + this.handle = null; + this.client = null; + } + + ReferenceExpression(Handle handle, AspireClient client) { + this.format = null; + this.valueProviders = null; + this.condition = null; + this.whenTrue = null; + this.whenFalse = null; + this.matchValue = null; + this.handle = handle; + this.client = client; + } + + boolean isConditional() { + return condition != null; + } + + boolean isHandle() { + return handle != null; + } + + Map toJson() { + if (handle != null) { + return handle.toJson(); + } + + Map expression = new HashMap<>(); + if (isConditional()) { + expression.put("condition", extractValueProvider(condition)); + expression.put("whenTrue", whenTrue.toJson()); + expression.put("whenFalse", whenFalse.toJson()); + expression.put("matchValue", matchValue); + } else { + expression.put("format", format); + if (valueProviders != null && valueProviders.length > 0) { + List providers = new ArrayList<>(valueProviders.length); + for (Object valueProvider : valueProviders) { + providers.add(extractValueProvider(valueProvider)); + } + expression.put("valueProviders", providers); + } + } + + Map result = new HashMap<>(); + result.put("$expr", expression); + return result; + } + + public String getValue() { + return getValue(null); + } + + public String getValue(CancellationToken cancellationToken) { + if (handle == null || client == null) { + throw new IllegalStateException("getValue is only available on server-returned ReferenceExpression instances"); + } + + Map reqArgs = new HashMap<>(); + reqArgs.put("context", AspireClient.serializeValue(handle)); + if (cancellationToken != null) { + reqArgs.put("cancellationToken", client.registerCancellation(cancellationToken)); + } + + return (String) client.invokeCapability("Aspire.Hosting.ApplicationModel/getValue", reqArgs); + } + + public static ReferenceExpression refExpr(String format, Object... valueProviders) { + return new ReferenceExpression(format, valueProviders); + } + + public static ReferenceExpression createConditional(Object condition, String matchValue, ReferenceExpression whenTrue, ReferenceExpression whenFalse) { + return new ReferenceExpression(condition, matchValue, whenTrue, whenFalse); + } + + private static Object extractValueProvider(Object value) { + if (value == null) { + throw new IllegalArgumentException("Cannot use null in a reference expression"); + } + + if (value instanceof String || value instanceof Number || value instanceof Boolean) { + return value; + } + + return AspireClient.serializeValue(value); + } +} + +// ===== ResourceBuilderBase.java ===== +// ResourceBuilderBase.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; + +/** + * ResourceBuilderBase extends HandleWrapperBase for resource builders. + */ +public class ResourceBuilderBase extends HandleWrapperBase { + ResourceBuilderBase(Handle handle, AspireClient client) { + super(handle, client); + } +} + +// ===== TestCallbackContext.java ===== +// TestCallbackContext.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + /** Wrapper for Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestCallbackContext. */ -class TestCallbackContext extends HandleWrapperBase { +public class TestCallbackContext extends HandleWrapperBase { TestCallbackContext(Handle handle, AspireClient client) { super(handle, client); } @@ -247,8 +1456,16 @@ public TestCallbackContext setCancellationToken(CancellationToken value) { } +// ===== TestCollectionContext.java ===== +// TestCollectionContext.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + /** Wrapper for Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestCollectionContext. */ -class TestCollectionContext extends HandleWrapperBase { +public class TestCollectionContext extends HandleWrapperBase { TestCollectionContext(Handle handle, AspireClient client) { super(handle, client); } @@ -271,16 +1488,69 @@ public AspireDict metadata() { return metadataField; } -} +} + +// ===== TestConfigDto.java ===== +// TestConfigDto.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** TestConfigDto DTO. */ +public class TestConfigDto { + private String name; + private double port; + private boolean enabled; + private String optionalField; + + public String getName() { return name; } + public void setName(String value) { this.name = value; } + public double getPort() { return port; } + public void setPort(double value) { this.port = value; } + public boolean getEnabled() { return enabled; } + public void setEnabled(boolean value) { this.enabled = value; } + public String getOptionalField() { return optionalField; } + public void setOptionalField(String value) { this.optionalField = value; } + + public Map toMap() { + Map map = new HashMap<>(); + map.put("Name", AspireClient.serializeValue(name)); + map.put("Port", AspireClient.serializeValue(port)); + map.put("Enabled", AspireClient.serializeValue(enabled)); + map.put("OptionalField", AspireClient.serializeValue(optionalField)); + return map; + } +} + +// ===== TestDatabaseResource.java ===== +// TestDatabaseResource.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; /** Wrapper for Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestDatabaseResource. */ -class TestDatabaseResource extends ResourceBuilderBase { +public class TestDatabaseResource extends ResourceBuilderBase { TestDatabaseResource(Handle handle, AspireClient client) { super(handle, client); } /** Adds an optional string parameter */ - public IResource withOptionalString(String value, Boolean enabled) { + public TestDatabaseResource withOptionalString(WithOptionalStringOptions options) { + var value = options == null ? null : options.getValue(); + var enabled = options == null ? null : options.getEnabled(); + return withOptionalStringImpl(value, enabled); + } + + public TestDatabaseResource withOptionalString() { + return withOptionalString(null); + } + + /** Adds an optional string parameter */ + private TestDatabaseResource withOptionalStringImpl(String value, Boolean enabled) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); if (value != null) { @@ -289,143 +1559,234 @@ public IResource withOptionalString(String value, Boolean enabled) { if (enabled != null) { reqArgs.put("enabled", AspireClient.serializeValue(enabled)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalString", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalString", reqArgs); + return this; } /** Configures the resource with a DTO */ - public IResource withConfig(TestConfigDto config) { + public TestDatabaseResource withConfig(TestConfigDto config) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("config", AspireClient.serializeValue(config)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConfig", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConfig", reqArgs); + return this; } /** Configures environment with callback (test version) */ - public IResourceWithEnvironment testWithEnvironmentCallback(Function callback) { + public TestDatabaseResource testWithEnvironmentCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var arg = (TestEnvironmentContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWithEnvironmentCallback", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWithEnvironmentCallback", reqArgs); + return this; } /** Sets the created timestamp */ - public IResource withCreatedAt(String createdAt) { + public TestDatabaseResource withCreatedAt(String createdAt) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("createdAt", AspireClient.serializeValue(createdAt)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCreatedAt", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCreatedAt", reqArgs); + return this; } /** Sets the modified timestamp */ - public IResource withModifiedAt(String modifiedAt) { + public TestDatabaseResource withModifiedAt(String modifiedAt) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("modifiedAt", AspireClient.serializeValue(modifiedAt)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withModifiedAt", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withModifiedAt", reqArgs); + return this; } /** Sets the correlation ID */ - public IResource withCorrelationId(String correlationId) { + public TestDatabaseResource withCorrelationId(String correlationId) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("correlationId", AspireClient.serializeValue(correlationId)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCorrelationId", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCorrelationId", reqArgs); + return this; + } + + public TestDatabaseResource withOptionalCallback() { + return withOptionalCallback(null); } /** Configures with optional callback */ - public IResource withOptionalCallback(Function callback) { + public TestDatabaseResource withOptionalCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = callback == null ? null : getClient().registerCallback(args -> { + var arg = (TestCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalCallback", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalCallback", reqArgs); + return this; } /** Sets the resource status */ - public IResource withStatus(TestResourceStatus status) { + public TestDatabaseResource withStatus(TestResourceStatus status) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("status", AspireClient.serializeValue(status)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withStatus", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withStatus", reqArgs); + return this; } /** Configures with nested DTO */ - public IResource withNestedConfig(TestNestedDto config) { + public TestDatabaseResource withNestedConfig(TestNestedDto config) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("config", AspireClient.serializeValue(config)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withNestedConfig", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withNestedConfig", reqArgs); + return this; } /** Adds validation callback */ - public IResource withValidator(Function validator) { + public TestDatabaseResource withValidator(AspireFunc1 validator) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (validator != null) { - reqArgs.put("validator", getClient().registerCallback(validator)); + var validatorId = getClient().registerCallback(args -> { + var arg = (TestResourceContext) args[0]; + return AspireClient.awaitValue(validator.invoke(arg)); + }); + if (validatorId != null) { + reqArgs.put("validator", validatorId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withValidator", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withValidator", reqArgs); + return this; } /** Waits for another resource (test version) */ - public IResource testWaitFor(IResource dependency) { + public TestDatabaseResource testWaitFor(IResource dependency) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWaitFor", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWaitFor", reqArgs); + return this; + } + + public TestDatabaseResource testWaitFor(ResourceBuilderBase dependency) { + return testWaitFor(new IResource(dependency.getHandle(), dependency.getClient())); } /** Adds a dependency on another resource */ - public IResource withDependency(IResourceWithConnectionString dependency) { + public TestDatabaseResource withDependency(IResourceWithConnectionString dependency) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDependency", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDependency", reqArgs); + return this; + } + + public TestDatabaseResource withDependency(ResourceBuilderBase dependency) { + return withDependency(new IResourceWithConnectionString(dependency.getHandle(), dependency.getClient())); } /** Sets the endpoints */ - public IResource withEndpoints(String[] endpoints) { + public TestDatabaseResource withEndpoints(String[] endpoints) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("endpoints", AspireClient.serializeValue(endpoints)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEndpoints", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEndpoints", reqArgs); + return this; } /** Sets environment variables */ - public IResourceWithEnvironment withEnvironmentVariables(Map variables) { + public TestDatabaseResource withEnvironmentVariables(Map variables) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("variables", AspireClient.serializeValue(variables)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEnvironmentVariables", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEnvironmentVariables", reqArgs); + return this; } /** Performs a cancellable operation */ - public IResource withCancellableOperation(Function operation) { + public TestDatabaseResource withCancellableOperation(AspireAction1 operation) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (operation != null) { - reqArgs.put("operation", getClient().registerCallback(operation)); + var operationId = getClient().registerCallback(args -> { + var arg = CancellationToken.fromValue(args[0]); + operation.invoke(arg); + return null; + }); + if (operationId != null) { + reqArgs.put("operation", operationId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCancellableOperation", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCancellableOperation", reqArgs); + return this; + } + + /** Adds a data volume */ + public TestDatabaseResource withDataVolume(WithDataVolumeOptions options) { + var name = options == null ? null : options.getName(); + return withDataVolumeImpl(name); + } + + public TestDatabaseResource withDataVolume() { + return withDataVolume(null); } /** Adds a data volume */ - public TestDatabaseResource withDataVolume(String name) { + private TestDatabaseResource withDataVolumeImpl(String name) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); if (name != null) { reqArgs.put("name", AspireClient.serializeValue(name)); } - return (TestDatabaseResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDataVolume", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDataVolume", reqArgs); + return this; } } +// ===== TestDeeplyNestedDto.java ===== +// TestDeeplyNestedDto.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** TestDeeplyNestedDto DTO. */ +public class TestDeeplyNestedDto { + private AspireDict> nestedData; + private AspireDict[] metadataArray; + + public AspireDict> getNestedData() { return nestedData; } + public void setNestedData(AspireDict> value) { this.nestedData = value; } + public AspireDict[] getMetadataArray() { return metadataArray; } + public void setMetadataArray(AspireDict[] value) { this.metadataArray = value; } + + public Map toMap() { + Map map = new HashMap<>(); + map.put("NestedData", AspireClient.serializeValue(nestedData)); + map.put("MetadataArray", AspireClient.serializeValue(metadataArray)); + return map; + } +} + +// ===== TestEnvironmentContext.java ===== +// TestEnvironmentContext.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + /** Wrapper for Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestEnvironmentContext. */ -class TestEnvironmentContext extends HandleWrapperBase { +public class TestEnvironmentContext extends HandleWrapperBase { TestEnvironmentContext(Handle handle, AspireClient client) { super(handle, client); } @@ -477,12 +1838,88 @@ public TestEnvironmentContext setPriority(double value) { } +// ===== TestNestedDto.java ===== +// TestNestedDto.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** TestNestedDto DTO. */ +public class TestNestedDto { + private String id; + private TestConfigDto config; + private AspireList tags; + private AspireDict counts; + + public String getId() { return id; } + public void setId(String value) { this.id = value; } + public TestConfigDto getConfig() { return config; } + public void setConfig(TestConfigDto value) { this.config = value; } + public AspireList getTags() { return tags; } + public void setTags(AspireList value) { this.tags = value; } + public AspireDict getCounts() { return counts; } + public void setCounts(AspireDict value) { this.counts = value; } + + public Map toMap() { + Map map = new HashMap<>(); + map.put("Id", AspireClient.serializeValue(id)); + map.put("Config", AspireClient.serializeValue(config)); + map.put("Tags", AspireClient.serializeValue(tags)); + map.put("Counts", AspireClient.serializeValue(counts)); + return map; + } +} + +// ===== TestPersistenceMode.java ===== +// TestPersistenceMode.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** TestPersistenceMode enum. */ +public enum TestPersistenceMode implements WireValueEnum { + NONE("None"), + VOLUME("Volume"), + BIND("Bind"); + + private final String value; + + TestPersistenceMode(String value) { + this.value = value; + } + + public String getValue() { return value; } + + public static TestPersistenceMode fromValue(String value) { + for (TestPersistenceMode e : values()) { + if (e.value.equals(value)) return e; + } + throw new IllegalArgumentException("Unknown value: " + value); + } +} + +// ===== TestRedisResource.java ===== +// TestRedisResource.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + /** Wrapper for Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestRedisResource. */ -class TestRedisResource extends ResourceBuilderBase { +public class TestRedisResource extends ResourceBuilderBase { TestRedisResource(Handle handle, AspireClient client) { super(handle, client); } + public TestDatabaseResource addTestChildDatabase(String name) { + return addTestChildDatabase(name, null); + } + /** Adds a child database to a test Redis resource */ public TestDatabaseResource addTestChildDatabase(String name, String databaseName) { Map reqArgs = new HashMap<>(); @@ -494,6 +1931,10 @@ public TestDatabaseResource addTestChildDatabase(String name, String databaseNam return (TestDatabaseResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/addTestChildDatabase", reqArgs); } + public TestRedisResource withPersistence() { + return withPersistence(null); + } + /** Configures the Redis resource with persistence */ public TestRedisResource withPersistence(TestPersistenceMode mode) { Map reqArgs = new HashMap<>(); @@ -501,11 +1942,23 @@ public TestRedisResource withPersistence(TestPersistenceMode mode) { if (mode != null) { reqArgs.put("mode", AspireClient.serializeValue(mode)); } - return (TestRedisResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withPersistence", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withPersistence", reqArgs); + return this; + } + + /** Adds an optional string parameter */ + public TestRedisResource withOptionalString(WithOptionalStringOptions options) { + var value = options == null ? null : options.getValue(); + var enabled = options == null ? null : options.getEnabled(); + return withOptionalStringImpl(value, enabled); + } + + public TestRedisResource withOptionalString() { + return withOptionalString(null); } /** Adds an optional string parameter */ - public IResource withOptionalString(String value, Boolean enabled) { + private TestRedisResource withOptionalStringImpl(String value, Boolean enabled) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); if (value != null) { @@ -514,15 +1967,17 @@ public IResource withOptionalString(String value, Boolean enabled) { if (enabled != null) { reqArgs.put("enabled", AspireClient.serializeValue(enabled)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalString", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalString", reqArgs); + return this; } /** Configures the resource with a DTO */ - public IResource withConfig(TestConfigDto config) { + public TestRedisResource withConfig(TestConfigDto config) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("config", AspireClient.serializeValue(config)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConfig", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConfig", reqArgs); + return this; } /** Gets the tags for the resource */ @@ -544,89 +1999,121 @@ public AspireDict getMetadata() { } /** Sets the connection string using a reference expression */ - public IResourceWithConnectionString withConnectionString(ReferenceExpression connectionString) { + public TestRedisResource withConnectionString(ReferenceExpression connectionString) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("connectionString", AspireClient.serializeValue(connectionString)); - return (IResourceWithConnectionString) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConnectionString", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConnectionString", reqArgs); + return this; } /** Configures environment with callback (test version) */ - public IResourceWithEnvironment testWithEnvironmentCallback(Function callback) { + public TestRedisResource testWithEnvironmentCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var arg = (TestEnvironmentContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWithEnvironmentCallback", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWithEnvironmentCallback", reqArgs); + return this; } /** Sets the created timestamp */ - public IResource withCreatedAt(String createdAt) { + public TestRedisResource withCreatedAt(String createdAt) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("createdAt", AspireClient.serializeValue(createdAt)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCreatedAt", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCreatedAt", reqArgs); + return this; } /** Sets the modified timestamp */ - public IResource withModifiedAt(String modifiedAt) { + public TestRedisResource withModifiedAt(String modifiedAt) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("modifiedAt", AspireClient.serializeValue(modifiedAt)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withModifiedAt", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withModifiedAt", reqArgs); + return this; } /** Sets the correlation ID */ - public IResource withCorrelationId(String correlationId) { + public TestRedisResource withCorrelationId(String correlationId) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("correlationId", AspireClient.serializeValue(correlationId)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCorrelationId", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCorrelationId", reqArgs); + return this; + } + + public TestRedisResource withOptionalCallback() { + return withOptionalCallback(null); } /** Configures with optional callback */ - public IResource withOptionalCallback(Function callback) { + public TestRedisResource withOptionalCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = callback == null ? null : getClient().registerCallback(args -> { + var arg = (TestCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalCallback", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalCallback", reqArgs); + return this; } /** Sets the resource status */ - public IResource withStatus(TestResourceStatus status) { + public TestRedisResource withStatus(TestResourceStatus status) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("status", AspireClient.serializeValue(status)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withStatus", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withStatus", reqArgs); + return this; } /** Configures with nested DTO */ - public IResource withNestedConfig(TestNestedDto config) { + public TestRedisResource withNestedConfig(TestNestedDto config) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("config", AspireClient.serializeValue(config)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withNestedConfig", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withNestedConfig", reqArgs); + return this; } /** Adds validation callback */ - public IResource withValidator(Function validator) { + public TestRedisResource withValidator(AspireFunc1 validator) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (validator != null) { - reqArgs.put("validator", getClient().registerCallback(validator)); + var validatorId = getClient().registerCallback(args -> { + var arg = (TestResourceContext) args[0]; + return AspireClient.awaitValue(validator.invoke(arg)); + }); + if (validatorId != null) { + reqArgs.put("validator", validatorId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withValidator", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withValidator", reqArgs); + return this; } /** Waits for another resource (test version) */ - public IResource testWaitFor(IResource dependency) { + public TestRedisResource testWaitFor(IResource dependency) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWaitFor", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWaitFor", reqArgs); + return this; + } + + public TestRedisResource testWaitFor(ResourceBuilderBase dependency) { + return testWaitFor(new IResource(dependency.getHandle(), dependency.getClient())); } /** Gets the endpoints */ @@ -637,11 +2124,12 @@ public String[] getEndpoints() { } /** Sets connection string using direct interface target */ - public IResourceWithConnectionString withConnectionStringDirect(String connectionString) { + public TestRedisResource withConnectionStringDirect(String connectionString) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("connectionString", AspireClient.serializeValue(connectionString)); - return (IResourceWithConnectionString) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConnectionStringDirect", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConnectionStringDirect", reqArgs); + return this; } /** Redis-specific configuration */ @@ -649,31 +2137,43 @@ public TestRedisResource withRedisSpecific(String option) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("option", AspireClient.serializeValue(option)); - return (TestRedisResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withRedisSpecific", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withRedisSpecific", reqArgs); + return this; } /** Adds a dependency on another resource */ - public IResource withDependency(IResourceWithConnectionString dependency) { + public TestRedisResource withDependency(IResourceWithConnectionString dependency) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDependency", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDependency", reqArgs); + return this; + } + + public TestRedisResource withDependency(ResourceBuilderBase dependency) { + return withDependency(new IResourceWithConnectionString(dependency.getHandle(), dependency.getClient())); } /** Sets the endpoints */ - public IResource withEndpoints(String[] endpoints) { + public TestRedisResource withEndpoints(String[] endpoints) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("endpoints", AspireClient.serializeValue(endpoints)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEndpoints", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEndpoints", reqArgs); + return this; } /** Sets environment variables */ - public IResourceWithEnvironment withEnvironmentVariables(Map variables) { + public TestRedisResource withEnvironmentVariables(Map variables) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("variables", AspireClient.serializeValue(variables)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEnvironmentVariables", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEnvironmentVariables", reqArgs); + return this; + } + + public String getStatusAsync() { + return getStatusAsync(null); } /** Gets the status of the resource asynchronously */ @@ -687,13 +2187,23 @@ public String getStatusAsync(CancellationToken cancellationToken) { } /** Performs a cancellable operation */ - public IResource withCancellableOperation(Function operation) { + public TestRedisResource withCancellableOperation(AspireAction1 operation) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (operation != null) { - reqArgs.put("operation", getClient().registerCallback(operation)); + var operationId = getClient().registerCallback(args -> { + var arg = CancellationToken.fromValue(args[0]); + operation.invoke(arg); + return null; + }); + if (operationId != null) { + reqArgs.put("operation", operationId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCancellableOperation", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCancellableOperation", reqArgs); + return this; + } + + public boolean waitForReadyAsync(double timeout) { + return waitForReadyAsync(timeout, null); } /** Waits for the resource to be ready */ @@ -708,17 +2218,35 @@ public boolean waitForReadyAsync(double timeout, CancellationToken cancellationT } /** Tests multi-param callback destructuring */ - public TestRedisResource withMultiParamHandleCallback(Function callback) { + public TestRedisResource withMultiParamHandleCallback(AspireAction2 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var arg1 = (TestCallbackContext) args[0]; + var arg2 = (TestEnvironmentContext) args[1]; + callback.invoke(arg1, arg2); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (TestRedisResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withMultiParamHandleCallback", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withMultiParamHandleCallback", reqArgs); + return this; + } + + /** Adds a data volume with persistence */ + public TestRedisResource withDataVolume(WithDataVolumeOptions options) { + var name = options == null ? null : options.getName(); + var isReadOnly = options == null ? null : options.isReadOnly(); + return withDataVolumeImpl(name, isReadOnly); + } + + public TestRedisResource withDataVolume() { + return withDataVolume(null); } /** Adds a data volume with persistence */ - public TestRedisResource withDataVolume(String name, Boolean isReadOnly) { + private TestRedisResource withDataVolumeImpl(String name, Boolean isReadOnly) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); if (name != null) { @@ -727,13 +2255,22 @@ public TestRedisResource withDataVolume(String name, Boolean isReadOnly) { if (isReadOnly != null) { reqArgs.put("isReadOnly", AspireClient.serializeValue(isReadOnly)); } - return (TestRedisResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDataVolume", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDataVolume", reqArgs); + return this; } } +// ===== TestResourceContext.java ===== +// TestResourceContext.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + /** Wrapper for Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestResourceContext. */ -class TestResourceContext extends HandleWrapperBase { +public class TestResourceContext extends HandleWrapperBase { TestResourceContext(Handle handle, AspireClient client) { super(handle, client); } @@ -792,14 +2329,64 @@ public boolean validateAsync() { } +// ===== TestResourceStatus.java ===== +// TestResourceStatus.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** TestResourceStatus enum. */ +public enum TestResourceStatus implements WireValueEnum { + PENDING("Pending"), + RUNNING("Running"), + STOPPED("Stopped"), + FAILED("Failed"); + + private final String value; + + TestResourceStatus(String value) { + this.value = value; + } + + public String getValue() { return value; } + + public static TestResourceStatus fromValue(String value) { + for (TestResourceStatus e : values()) { + if (e.value.equals(value)) return e; + } + throw new IllegalArgumentException("Unknown value: " + value); + } +} + +// ===== TestVaultResource.java ===== +// TestVaultResource.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + /** Wrapper for Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestVaultResource. */ -class TestVaultResource extends ResourceBuilderBase { +public class TestVaultResource extends ResourceBuilderBase { TestVaultResource(Handle handle, AspireClient client) { super(handle, client); } /** Adds an optional string parameter */ - public IResource withOptionalString(String value, Boolean enabled) { + public TestVaultResource withOptionalString(WithOptionalStringOptions options) { + var value = options == null ? null : options.getValue(); + var enabled = options == null ? null : options.getEnabled(); + return withOptionalStringImpl(value, enabled); + } + + public TestVaultResource withOptionalString() { + return withOptionalString(null); + } + + /** Adds an optional string parameter */ + private TestVaultResource withOptionalStringImpl(String value, Boolean enabled) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); if (value != null) { @@ -808,203 +2395,295 @@ public IResource withOptionalString(String value, Boolean enabled) { if (enabled != null) { reqArgs.put("enabled", AspireClient.serializeValue(enabled)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalString", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalString", reqArgs); + return this; } /** Configures the resource with a DTO */ - public IResource withConfig(TestConfigDto config) { + public TestVaultResource withConfig(TestConfigDto config) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("config", AspireClient.serializeValue(config)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConfig", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConfig", reqArgs); + return this; } /** Configures environment with callback (test version) */ - public IResourceWithEnvironment testWithEnvironmentCallback(Function callback) { + public TestVaultResource testWithEnvironmentCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var arg = (TestEnvironmentContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWithEnvironmentCallback", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWithEnvironmentCallback", reqArgs); + return this; } /** Sets the created timestamp */ - public IResource withCreatedAt(String createdAt) { + public TestVaultResource withCreatedAt(String createdAt) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("createdAt", AspireClient.serializeValue(createdAt)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCreatedAt", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCreatedAt", reqArgs); + return this; } /** Sets the modified timestamp */ - public IResource withModifiedAt(String modifiedAt) { + public TestVaultResource withModifiedAt(String modifiedAt) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("modifiedAt", AspireClient.serializeValue(modifiedAt)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withModifiedAt", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withModifiedAt", reqArgs); + return this; } /** Sets the correlation ID */ - public IResource withCorrelationId(String correlationId) { + public TestVaultResource withCorrelationId(String correlationId) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("correlationId", AspireClient.serializeValue(correlationId)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCorrelationId", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCorrelationId", reqArgs); + return this; + } + + public TestVaultResource withOptionalCallback() { + return withOptionalCallback(null); } /** Configures with optional callback */ - public IResource withOptionalCallback(Function callback) { + public TestVaultResource withOptionalCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = callback == null ? null : getClient().registerCallback(args -> { + var arg = (TestCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalCallback", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalCallback", reqArgs); + return this; } /** Sets the resource status */ - public IResource withStatus(TestResourceStatus status) { + public TestVaultResource withStatus(TestResourceStatus status) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("status", AspireClient.serializeValue(status)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withStatus", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withStatus", reqArgs); + return this; } /** Configures with nested DTO */ - public IResource withNestedConfig(TestNestedDto config) { + public TestVaultResource withNestedConfig(TestNestedDto config) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("config", AspireClient.serializeValue(config)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withNestedConfig", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withNestedConfig", reqArgs); + return this; } /** Adds validation callback */ - public IResource withValidator(Function validator) { + public TestVaultResource withValidator(AspireFunc1 validator) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (validator != null) { - reqArgs.put("validator", getClient().registerCallback(validator)); + var validatorId = getClient().registerCallback(args -> { + var arg = (TestResourceContext) args[0]; + return AspireClient.awaitValue(validator.invoke(arg)); + }); + if (validatorId != null) { + reqArgs.put("validator", validatorId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withValidator", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withValidator", reqArgs); + return this; } /** Waits for another resource (test version) */ - public IResource testWaitFor(IResource dependency) { + public TestVaultResource testWaitFor(IResource dependency) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWaitFor", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWaitFor", reqArgs); + return this; + } + + public TestVaultResource testWaitFor(ResourceBuilderBase dependency) { + return testWaitFor(new IResource(dependency.getHandle(), dependency.getClient())); } /** Adds a dependency on another resource */ - public IResource withDependency(IResourceWithConnectionString dependency) { + public TestVaultResource withDependency(IResourceWithConnectionString dependency) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDependency", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDependency", reqArgs); + return this; + } + + public TestVaultResource withDependency(ResourceBuilderBase dependency) { + return withDependency(new IResourceWithConnectionString(dependency.getHandle(), dependency.getClient())); } /** Sets the endpoints */ - public IResource withEndpoints(String[] endpoints) { + public TestVaultResource withEndpoints(String[] endpoints) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("endpoints", AspireClient.serializeValue(endpoints)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEndpoints", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEndpoints", reqArgs); + return this; } /** Sets environment variables */ - public IResourceWithEnvironment withEnvironmentVariables(Map variables) { + public TestVaultResource withEnvironmentVariables(Map variables) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("variables", AspireClient.serializeValue(variables)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEnvironmentVariables", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEnvironmentVariables", reqArgs); + return this; } /** Performs a cancellable operation */ - public IResource withCancellableOperation(Function operation) { + public TestVaultResource withCancellableOperation(AspireAction1 operation) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (operation != null) { - reqArgs.put("operation", getClient().registerCallback(operation)); + var operationId = getClient().registerCallback(args -> { + var arg = CancellationToken.fromValue(args[0]); + operation.invoke(arg); + return null; + }); + if (operationId != null) { + reqArgs.put("operation", operationId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCancellableOperation", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCancellableOperation", reqArgs); + return this; } /** Configures vault using direct interface target */ - public ITestVaultResource withVaultDirect(String option) { + public TestVaultResource withVaultDirect(String option) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("option", AspireClient.serializeValue(option)); - return (ITestVaultResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withVaultDirect", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withVaultDirect", reqArgs); + return this; } } -// ============================================================================ -// Handle wrapper registrations -// ============================================================================ +// ===== WireValueEnum.java ===== +// WireValueEnum.java - GENERATED CODE - DO NOT EDIT -/** Static initializer to register handle wrappers. */ -class AspireRegistrations { - static { - AspireClient.registerHandleWrapper("Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestCallbackContext", (h, c) -> new TestCallbackContext(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestResourceContext", (h, c) -> new TestResourceContext(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestEnvironmentContext", (h, c) -> new TestEnvironmentContext(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestCollectionContext", (h, c) -> new TestCollectionContext(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestRedisResource", (h, c) -> new TestRedisResource(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestDatabaseResource", (h, c) -> new TestDatabaseResource(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource", (h, c) -> new IResource(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString", (h, c) -> new IResourceWithConnectionString(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestVaultResource", (h, c) -> new TestVaultResource(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.ITestVaultResource", (h, c) -> new ITestVaultResource(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder", (h, c) -> new IDistributedApplicationBuilder(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment", (h, c) -> new IResourceWithEnvironment(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/List", (h, c) -> new AspireList(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Dict", (h, c) -> new AspireDict(h, c)); +package aspire; + +import java.util.*; + +/** + * Marker interface for generated enums that need a transport value distinct from Enum.name(). + */ +public interface WireValueEnum { + String getValue(); +} + +// ===== WithDataVolumeOptions.java ===== +// WithDataVolumeOptions.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Options for WithDataVolume. */ +public final class WithDataVolumeOptions { + private String name; + private Boolean isReadOnly; + + public String getName() { return name; } + public WithDataVolumeOptions name(String value) { + this.name = value; + return this; } - static void ensureRegistered() { - // Called to trigger static initializer + public Boolean isReadOnly() { return isReadOnly; } + public WithDataVolumeOptions isReadOnly(Boolean value) { + this.isReadOnly = value; + return this; } + } -// ============================================================================ -// Connection Helpers -// ============================================================================ +// ===== WithOptionalStringOptions.java ===== +// WithOptionalStringOptions.java - GENERATED CODE - DO NOT EDIT -/** Main entry point for Aspire SDK. */ -public class Aspire { - /** Connect to the AppHost server. */ - public static AspireClient connect() throws Exception { - AspireRegistrations.ensureRegistered(); - String socketPath = System.getenv("REMOTE_APP_HOST_SOCKET_PATH"); - if (socketPath == null || socketPath.isEmpty()) { - throw new RuntimeException("REMOTE_APP_HOST_SOCKET_PATH environment variable not set. Run this application using `aspire run`."); - } - AspireClient client = new AspireClient(socketPath); - client.connect(); - client.onDisconnect(() -> System.exit(1)); - return client; +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Options for WithOptionalString. */ +public final class WithOptionalStringOptions { + private String value; + private Boolean enabled; + + public String getValue() { return value; } + public WithOptionalStringOptions value(String value) { + this.value = value; + return this; } - /** Create a new distributed application builder. */ - public static IDistributedApplicationBuilder createBuilder(CreateBuilderOptions options) throws Exception { - AspireClient client = connect(); - Map resolvedOptions = new HashMap<>(); - if (options != null) { - resolvedOptions.putAll(options.toMap()); - } - if (!resolvedOptions.containsKey("Args")) { - // Note: Java doesn't have easy access to command line args from here - resolvedOptions.put("Args", new String[0]); - } - if (!resolvedOptions.containsKey("ProjectDirectory")) { - resolvedOptions.put("ProjectDirectory", System.getProperty("user.dir")); - } - Map args = new HashMap<>(); - args.put("options", resolvedOptions); - return (IDistributedApplicationBuilder) client.invokeCapability("Aspire.Hosting/createBuilderWithOptions", args); + public Boolean getEnabled() { return enabled; } + public WithOptionalStringOptions enabled(Boolean value) { + this.enabled = value; + return this; } + } +// ===== sources.txt ===== +.modules/Aspire.java +.modules/AspireAction0.java +.modules/AspireAction1.java +.modules/AspireAction2.java +.modules/AspireAction3.java +.modules/AspireAction4.java +.modules/AspireClient.java +.modules/AspireDict.java +.modules/AspireFunc0.java +.modules/AspireFunc1.java +.modules/AspireFunc2.java +.modules/AspireFunc3.java +.modules/AspireFunc4.java +.modules/AspireList.java +.modules/AspireRegistrations.java +.modules/AspireUnion.java +.modules/BaseRegistrations.java +.modules/CancellationToken.java +.modules/CapabilityError.java +.modules/Handle.java +.modules/HandleWrapperBase.java +.modules/IDistributedApplicationBuilder.java +.modules/IResource.java +.modules/IResourceWithConnectionString.java +.modules/IResourceWithEnvironment.java +.modules/ITestVaultResource.java +.modules/ReferenceExpression.java +.modules/ResourceBuilderBase.java +.modules/TestCallbackContext.java +.modules/TestCollectionContext.java +.modules/TestConfigDto.java +.modules/TestDatabaseResource.java +.modules/TestDeeplyNestedDto.java +.modules/TestEnvironmentContext.java +.modules/TestNestedDto.java +.modules/TestPersistenceMode.java +.modules/TestRedisResource.java +.modules/TestResourceContext.java +.modules/TestResourceStatus.java +.modules/TestVaultResource.java +.modules/WireValueEnum.java +.modules/WithDataVolumeOptions.java +.modules/WithOptionalStringOptions.java diff --git a/tests/Aspire.Hosting.CodeGeneration.Java.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.java b/tests/Aspire.Hosting.CodeGeneration.Java.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.java index daa2e42b8d4..defa632cbdb 100644 --- a/tests/Aspire.Hosting.CodeGeneration.Java.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.java +++ b/tests/Aspire.Hosting.CodeGeneration.Java.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.java @@ -1,332 +1,5559 @@ -// Aspire.java - Capability-based Aspire SDK -// GENERATED CODE - DO NOT EDIT +// ===== AddDockerfileOptions.java ===== +// AddDockerfileOptions.java - GENERATED CODE - DO NOT EDIT package aspire; import java.util.*; import java.util.function.*; -// ============================================================================ -// Enums -// ============================================================================ +/** Options for AddDockerfile. */ +public final class AddDockerfileOptions { + private String dockerfilePath; + private String stage; -/** ContainerLifetime enum. */ -enum ContainerLifetime { - SESSION("Session"), - PERSISTENT("Persistent"); - - private final String value; - - ContainerLifetime(String value) { - this.value = value; + public String getDockerfilePath() { return dockerfilePath; } + public AddDockerfileOptions dockerfilePath(String value) { + this.dockerfilePath = value; + return this; } - public String getValue() { return value; } - - public static ContainerLifetime fromValue(String value) { - for (ContainerLifetime e : values()) { - if (e.value.equals(value)) return e; - } - throw new IllegalArgumentException("Unknown value: " + value); + public String getStage() { return stage; } + public AddDockerfileOptions stage(String value) { + this.stage = value; + return this; } + } -/** ImagePullPolicy enum. */ -enum ImagePullPolicy { - DEFAULT("Default"), - ALWAYS("Always"), - MISSING("Missing"), - NEVER("Never"); +// ===== AddParameterWithValueOptions.java ===== +// AddParameterWithValueOptions.java - GENERATED CODE - DO NOT EDIT - private final String value; +package aspire; - ImagePullPolicy(String value) { - this.value = value; - } +import java.util.*; +import java.util.function.*; - public String getValue() { return value; } +/** Options for AddParameterWithValue. */ +public final class AddParameterWithValueOptions { + private Boolean publishValueAsDefault; + private Boolean secret; - public static ImagePullPolicy fromValue(String value) { - for (ImagePullPolicy e : values()) { - if (e.value.equals(value)) return e; - } - throw new IllegalArgumentException("Unknown value: " + value); + public Boolean getPublishValueAsDefault() { return publishValueAsDefault; } + public AddParameterWithValueOptions publishValueAsDefault(Boolean value) { + this.publishValueAsDefault = value; + return this; + } + + public Boolean getSecret() { return secret; } + public AddParameterWithValueOptions secret(Boolean value) { + this.secret = value; + return this; } + } -/** DistributedApplicationOperation enum. */ -enum DistributedApplicationOperation { - RUN("Run"), - PUBLISH("Publish"); +// ===== AfterResourcesCreatedEvent.java ===== +// AfterResourcesCreatedEvent.java - GENERATED CODE - DO NOT EDIT - private final String value; +package aspire; - DistributedApplicationOperation(String value) { - this.value = value; +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.AfterResourcesCreatedEvent. */ +public class AfterResourcesCreatedEvent extends HandleWrapperBase { + AfterResourcesCreatedEvent(Handle handle, AspireClient client) { + super(handle, client); } - public String getValue() { return value; } + /** Gets the Services property */ + public IServiceProvider services() { + Map reqArgs = new HashMap<>(); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (IServiceProvider) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.services", reqArgs); + } - public static DistributedApplicationOperation fromValue(String value) { - for (DistributedApplicationOperation e : values()) { - if (e.value.equals(value)) return e; - } - throw new IllegalArgumentException("Unknown value: " + value); + /** Gets the Model property */ + public DistributedApplicationModel model() { + Map reqArgs = new HashMap<>(); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (DistributedApplicationModel) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.model", reqArgs); } + } -/** OtlpProtocol enum. */ -enum OtlpProtocol { - GRPC("Grpc"), - HTTP_PROTOBUF("HttpProtobuf"), - HTTP_JSON("HttpJson"); +// ===== Aspire.java ===== +// Aspire.java - GENERATED CODE - DO NOT EDIT - private final String value; +package aspire; - OtlpProtocol(String value) { - this.value = value; - } +import java.util.*; +import java.util.function.*; - public String getValue() { return value; } +/** Main entry point for Aspire SDK. */ +public class Aspire { + /** Connect to the AppHost server. */ + public static AspireClient connect() throws Exception { + BaseRegistrations.ensureRegistered(); + AspireRegistrations.ensureRegistered(); + String socketPath = System.getenv("REMOTE_APP_HOST_SOCKET_PATH"); + if (socketPath == null || socketPath.isEmpty()) { + throw new RuntimeException("REMOTE_APP_HOST_SOCKET_PATH environment variable not set. Run this application using `aspire run`."); + } + AspireClient client = new AspireClient(socketPath); + client.connect(); + client.onDisconnect(() -> System.exit(1)); + return client; + } - public static OtlpProtocol fromValue(String value) { - for (OtlpProtocol e : values()) { - if (e.value.equals(value)) return e; + /** Create a new distributed application builder. */ + public static IDistributedApplicationBuilder createBuilder(CreateBuilderOptions options) throws Exception { + AspireClient client = connect(); + Map resolvedOptions = new HashMap<>(); + if (options != null) { + resolvedOptions.putAll(options.toMap()); } - throw new IllegalArgumentException("Unknown value: " + value); + if (resolvedOptions.get("Args") == null) { + // Note: Java doesn't have easy access to command line args from here + resolvedOptions.put("Args", new String[0]); + } + if (resolvedOptions.get("ProjectDirectory") == null) { + resolvedOptions.put("ProjectDirectory", System.getProperty("user.dir")); + } + if (resolvedOptions.get("AppHostFilePath") == null) { + String appHostFilePath = System.getenv("ASPIRE_APPHOST_FILEPATH"); + if (appHostFilePath != null && !appHostFilePath.isEmpty()) { + resolvedOptions.put("AppHostFilePath", appHostFilePath); + } + } + Map args = new HashMap<>(); + args.put("options", resolvedOptions); + return (IDistributedApplicationBuilder) client.invokeCapability("Aspire.Hosting/createBuilderWithOptions", args); } } -/** ProtocolType enum. */ -enum ProtocolType { - IP("IP"), - IPV6_HOP_BY_HOP_OPTIONS("IPv6HopByHopOptions"), - UNSPECIFIED("Unspecified"), - ICMP("Icmp"), - IGMP("Igmp"), - GGP("Ggp"), - IPV4("IPv4"), - TCP("Tcp"), - PUP("Pup"), - UDP("Udp"), - IDP("Idp"), - IPV6("IPv6"), - IPV6_ROUTING_HEADER("IPv6RoutingHeader"), - IPV6_FRAGMENT_HEADER("IPv6FragmentHeader"), - IPSEC_ENCAPSULATING_SECURITY_PAYLOAD("IPSecEncapsulatingSecurityPayload"), - IPSEC_AUTHENTICATION_HEADER("IPSecAuthenticationHeader"), - ICMP_V6("IcmpV6"), - IPV6_NO_NEXT_HEADER("IPv6NoNextHeader"), - IPV6_DESTINATION_OPTIONS("IPv6DestinationOptions"), - ND("ND"), - RAW("Raw"), - IPX("Ipx"), - SPX("Spx"), - SPX_II("SpxII"), - UNKNOWN("Unknown"); - - private final String value; +// ===== AspireAction0.java ===== +// AspireAction0.java - GENERATED CODE - DO NOT EDIT - ProtocolType(String value) { - this.value = value; - } +package aspire; - public String getValue() { return value; } +import java.util.*; - public static ProtocolType fromValue(String value) { - for (ProtocolType e : values()) { - if (e.value.equals(value)) return e; - } - throw new IllegalArgumentException("Unknown value: " + value); - } +@FunctionalInterface +public interface AspireAction0 { + void invoke(); } -/** WaitBehavior enum. */ -enum WaitBehavior { - WAIT_ON_RESOURCE_UNAVAILABLE("WaitOnResourceUnavailable"), - STOP_ON_RESOURCE_UNAVAILABLE("StopOnResourceUnavailable"); - - private final String value; +// ===== AspireAction1.java ===== +// AspireAction1.java - GENERATED CODE - DO NOT EDIT - WaitBehavior(String value) { - this.value = value; - } +package aspire; - public String getValue() { return value; } +import java.util.*; - public static WaitBehavior fromValue(String value) { - for (WaitBehavior e : values()) { - if (e.value.equals(value)) return e; - } - throw new IllegalArgumentException("Unknown value: " + value); - } +@FunctionalInterface +public interface AspireAction1 { + void invoke(T1 arg1); } -/** CertificateTrustScope enum. */ -enum CertificateTrustScope { - NONE("None"), - APPEND("Append"), - OVERRIDE("Override"), - SYSTEM("System"); - - private final String value; +// ===== AspireAction2.java ===== +// AspireAction2.java - GENERATED CODE - DO NOT EDIT - CertificateTrustScope(String value) { - this.value = value; - } +package aspire; - public String getValue() { return value; } +import java.util.*; - public static CertificateTrustScope fromValue(String value) { - for (CertificateTrustScope e : values()) { - if (e.value.equals(value)) return e; - } - throw new IllegalArgumentException("Unknown value: " + value); - } +@FunctionalInterface +public interface AspireAction2 { + void invoke(T1 arg1, T2 arg2); } -/** IconVariant enum. */ -enum IconVariant { - REGULAR("Regular"), - FILLED("Filled"); - - private final String value; +// ===== AspireAction3.java ===== +// AspireAction3.java - GENERATED CODE - DO NOT EDIT - IconVariant(String value) { - this.value = value; - } +package aspire; - public String getValue() { return value; } +import java.util.*; - public static IconVariant fromValue(String value) { - for (IconVariant e : values()) { - if (e.value.equals(value)) return e; - } - throw new IllegalArgumentException("Unknown value: " + value); - } +@FunctionalInterface +public interface AspireAction3 { + void invoke(T1 arg1, T2 arg2, T3 arg3); } -/** ProbeType enum. */ -enum ProbeType { - STARTUP("Startup"), - READINESS("Readiness"), - LIVENESS("Liveness"); +// ===== AspireAction4.java ===== +// AspireAction4.java - GENERATED CODE - DO NOT EDIT - private final String value; +package aspire; - ProbeType(String value) { - this.value = value; - } +import java.util.*; - public String getValue() { return value; } +@FunctionalInterface +public interface AspireAction4 { + void invoke(T1 arg1, T2 arg2, T3 arg3, T4 arg4); +} - public static ProbeType fromValue(String value) { - for (ProbeType e : values()) { - if (e.value.equals(value)) return e; +// ===== AspireClient.java ===== +// AspireClient.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.io.*; +import java.net.*; +import java.nio.charset.StandardCharsets; +import java.util.*; +import java.util.concurrent.*; +import java.util.concurrent.atomic.*; +import java.util.function.*; + +/** + * AspireClient handles JSON-RPC communication with the AppHost server. + */ +public class AspireClient { + private static final boolean DEBUG = System.getenv("ASPIRE_DEBUG") != null; + + private final String socketPath; + private OutputStream outputStream; + private InputStream inputStream; + private final AtomicInteger requestId = new AtomicInteger(0); + private final Map> callbacks = new ConcurrentHashMap<>(); + private final Map> cancellations = new ConcurrentHashMap<>(); + private Runnable disconnectHandler; + private volatile boolean connected = false; + + // Handle wrapper factory registry + private static final Map> handleWrappers = new ConcurrentHashMap<>(); + + public static void registerHandleWrapper(String typeId, BiFunction factory) { + handleWrappers.put(typeId, factory); + } + + public AspireClient(String socketPath) { + this.socketPath = socketPath; + } + + public void connect() throws IOException { + debug("Connecting to AppHost server at " + socketPath); + + if (isWindows()) { + connectWindowsNamedPipe(); + } else { + connectUnixSocket(); + } + + connected = true; + debug("Connected successfully"); + } + + private boolean isWindows() { + return System.getProperty("os.name").toLowerCase().contains("win"); + } + + private void connectWindowsNamedPipe() throws IOException { + // Extract just the filename from the socket path for the named pipe + String pipeName = new java.io.File(socketPath).getName(); + String pipePath = "\\\\.\\pipe\\" + pipeName; + debug("Opening Windows named pipe: " + pipePath); + + // Use RandomAccessFile to open the named pipe + RandomAccessFile pipe = new RandomAccessFile(pipePath, "rw"); + + // Create streams from the RandomAccessFile + FileDescriptor fd = pipe.getFD(); + inputStream = new FileInputStream(fd); + outputStream = new FileOutputStream(fd); + + debug("Named pipe opened successfully"); + } + + private void connectUnixSocket() throws IOException { + // Use Java 16+ Unix domain socket support + debug("Opening Unix domain socket: " + socketPath); + var address = java.net.UnixDomainSocketAddress.of(socketPath); + var channel = java.nio.channels.SocketChannel.open(address); + + // Create streams from the channel + inputStream = java.nio.channels.Channels.newInputStream(channel); + outputStream = java.nio.channels.Channels.newOutputStream(channel); + + debug("Unix domain socket opened successfully"); + } + + public void onDisconnect(Runnable handler) { + this.disconnectHandler = handler; + } + + public Object invokeCapability(String capabilityId, Map args) { + int id = requestId.incrementAndGet(); + + Map params = new HashMap<>(); + params.put("capabilityId", capabilityId); + params.put("args", args); + + Map request = new HashMap<>(); + request.put("jsonrpc", "2.0"); + request.put("id", id); + request.put("method", "invokeCapability"); + request.put("params", params); + + debug("Sending request invokeCapability with id=" + id); + + try { + sendMessage(request); + return readResponse(id); + } catch (IOException e) { + handleDisconnect(); + throw new RuntimeException("Failed to invoke capability: " + e.getMessage(), e); + } + } + + private void sendMessage(Map message) throws IOException { + String json = toJson(message); + byte[] content = json.getBytes(StandardCharsets.UTF_8); + String header = "Content-Length: " + content.length + "\r\n\r\n"; + + debug("Writing message: " + message.get("method") + " (id=" + message.get("id") + ")"); + + synchronized (outputStream) { + outputStream.write(header.getBytes(StandardCharsets.UTF_8)); + outputStream.write(content); + outputStream.flush(); + } + } + + private Object readResponse(int expectedId) throws IOException { + while (true) { + Map message = readMessage(); + + if (message.containsKey("method")) { + // This is a request from server (callback invocation) + handleServerRequest(message); + continue; + } + + // This is a response + Object idObj = message.get("id"); + int responseId = idObj instanceof Number ? ((Number) idObj).intValue() : Integer.parseInt(idObj.toString()); + + if (responseId != expectedId) { + debug("Received response for different id: " + responseId + " (expected " + expectedId + ")"); + continue; + } + + if (message.containsKey("error")) { + @SuppressWarnings("unchecked") + Map error = (Map) message.get("error"); + String code = String.valueOf(error.get("code")); + String errorMessage = String.valueOf(error.get("message")); + Object data = error.get("data"); + throw new CapabilityError(code, errorMessage, data); + } + + Object result = message.get("result"); + return unwrapResult(result); + } + } + + @SuppressWarnings("unchecked") + private Map readMessage() throws IOException { + // Read headers + StringBuilder headerBuilder = new StringBuilder(); + int contentLength = -1; + + while (true) { + String line = readLine(); + if (line.isEmpty()) { + break; + } + if (line.startsWith("Content-Length:")) { + contentLength = Integer.parseInt(line.substring(15).trim()); + } + } + + if (contentLength < 0) { + throw new IOException("No Content-Length header found"); + } + + // Read body + byte[] body = new byte[contentLength]; + int totalRead = 0; + while (totalRead < contentLength) { + int read = inputStream.read(body, totalRead, contentLength - totalRead); + if (read < 0) { + throw new IOException("Unexpected end of stream"); + } + totalRead += read; + } + + String json = new String(body, StandardCharsets.UTF_8); + debug("Received: " + json.substring(0, Math.min(200, json.length())) + "..."); + + return (Map) parseJson(json); + } + + private String readLine() throws IOException { + StringBuilder sb = new StringBuilder(); + int ch; + while ((ch = inputStream.read()) != -1) { + if (ch == '\r') { + int next = inputStream.read(); + if (next == '\n') { + break; + } + sb.append((char) ch); + if (next != -1) sb.append((char) next); + } else if (ch == '\n') { + break; + } else { + sb.append((char) ch); + } + } + return sb.toString(); + } + + @SuppressWarnings("unchecked") + private void handleServerRequest(Map request) throws IOException { + String method = (String) request.get("method"); + Object idObj = request.get("id"); + Map params = (Map) request.get("params"); + + debug("Received server request: " + method); + + Object result = null; + Map error = null; + + try { + if ("invokeCallback".equals(method)) { + String callbackId = (String) params.get("callbackId"); + List args = (List) params.get("args"); + + Function callback = callbacks.get(callbackId); + if (callback != null) { + Object[] unwrappedArgs = args.stream() + .map(this::unwrapResult) + .toArray(); + result = awaitValue(callback.apply(unwrappedArgs)); + } else { + error = createError(-32601, "Callback not found: " + callbackId); + } + } else if ("cancel".equals(method)) { + String cancellationId = (String) params.get("cancellationId"); + Consumer handler = cancellations.get(cancellationId); + if (handler != null) { + handler.accept(null); + } + result = true; + } else { + error = createError(-32601, "Unknown method: " + method); + } + } catch (Exception e) { + error = createError(-32603, e.getMessage()); + } + + // Send response + Map response = new HashMap<>(); + response.put("jsonrpc", "2.0"); + response.put("id", idObj); + if (error != null) { + response.put("error", error); + } else { + response.put("result", serializeValue(result)); + } + + sendMessage(response); + } + + private Map createError(int code, String message) { + Map error = new HashMap<>(); + error.put("code", code); + error.put("message", message); + return error; + } + + @SuppressWarnings("unchecked") + private Object unwrapResult(Object value) { + if (value == null) { + return null; + } + + if (value instanceof Map) { + Map map = (Map) value; + + // Check for handle + if (map.containsKey("$handle")) { + String handleId = (String) map.get("$handle"); + String typeId = (String) map.get("$type"); + Handle handle = new Handle(handleId, typeId); + + BiFunction factory = handleWrappers.get(typeId); + if (factory != null) { + return factory.apply(handle, this); + } + return handle; + } + + // Check for error + if (map.containsKey("$error")) { + Map errorData = (Map) map.get("$error"); + String code = String.valueOf(errorData.get("code")); + String message = String.valueOf(errorData.get("message")); + throw new CapabilityError(code, message, errorData.get("data")); + } + + // Recursively unwrap map values + Map result = new HashMap<>(); + for (Map.Entry entry : map.entrySet()) { + result.put(entry.getKey(), unwrapResult(entry.getValue())); + } + return result; + } + + if (value instanceof List) { + List list = (List) value; + List result = new ArrayList<>(); + for (Object item : list) { + result.add(unwrapResult(item)); + } + return result; + } + + return value; + } + + private void handleDisconnect() { + connected = false; + if (disconnectHandler != null) { + disconnectHandler.run(); + } + } + + public String registerCallback(Function callback) { + String id = UUID.randomUUID().toString(); + callbacks.put(id, callback); + return id; + } + + public String registerCancellation(CancellationToken token) { + String id = UUID.randomUUID().toString(); + cancellations.put(id, v -> token.cancel()); + return id; + } + + public static Object awaitValue(Object value) { + if (value instanceof CompletionStage stage) { + return stage.toCompletableFuture().join(); + } + return value; + } + + // Simple JSON serialization (no external dependencies) + public static Object serializeValue(Object value) { + if (value == null) { + return null; + } + if (value instanceof Handle) { + return ((Handle) value).toJson(); + } + if (value instanceof HandleWrapperBase) { + return ((HandleWrapperBase) value).getHandle().toJson(); + } + if (value instanceof ReferenceExpression) { + return ((ReferenceExpression) value).toJson(); + } + if (value instanceof AspireUnion union) { + return serializeValue(union.getValue()); + } + if (value instanceof Map) { + @SuppressWarnings("unchecked") + Map map = (Map) value; + Map result = new HashMap<>(); + for (Map.Entry entry : map.entrySet()) { + result.put(entry.getKey(), serializeValue(entry.getValue())); + } + return result; + } + if (value instanceof List) { + @SuppressWarnings("unchecked") + List list = (List) value; + List result = new ArrayList<>(); + for (Object item : list) { + result.add(serializeValue(item)); + } + return result; + } + if (value instanceof Object[]) { + Object[] array = (Object[]) value; + List result = new ArrayList<>(); + for (Object item : array) { + result.add(serializeValue(item)); + } + return result; + } + if (value instanceof WireValueEnum wireValueEnum) { + return wireValueEnum.getValue(); + } + if (value instanceof Enum) { + return ((Enum) value).name(); + } + return value; + } + + // Simple JSON encoding + private String toJson(Object value) { + if (value == null) { + return "null"; + } + if (value instanceof String) { + return "\"" + escapeJson((String) value) + "\""; + } + if (value instanceof Number || value instanceof Boolean) { + return value.toString(); + } + if (value instanceof Map) { + @SuppressWarnings("unchecked") + Map map = (Map) value; + StringBuilder sb = new StringBuilder("{"); + boolean first = true; + for (Map.Entry entry : map.entrySet()) { + if (!first) sb.append(","); + first = false; + sb.append("\"").append(escapeJson(entry.getKey())).append("\":"); + sb.append(toJson(entry.getValue())); + } + sb.append("}"); + return sb.toString(); + } + if (value instanceof List) { + @SuppressWarnings("unchecked") + List list = (List) value; + StringBuilder sb = new StringBuilder("["); + boolean first = true; + for (Object item : list) { + if (!first) sb.append(","); + first = false; + sb.append(toJson(item)); + } + sb.append("]"); + return sb.toString(); + } + if (value instanceof Object[]) { + Object[] array = (Object[]) value; + StringBuilder sb = new StringBuilder("["); + boolean first = true; + for (Object item : array) { + if (!first) sb.append(","); + first = false; + sb.append(toJson(item)); + } + sb.append("]"); + return sb.toString(); + } + return "\"" + escapeJson(value.toString()) + "\""; + } + + private String escapeJson(String s) { + StringBuilder sb = new StringBuilder(); + for (char c : s.toCharArray()) { + switch (c) { + case '"': sb.append("\\\""); break; + case '\\': sb.append("\\\\"); break; + case '\b': sb.append("\\b"); break; + case '\f': sb.append("\\f"); break; + case '\n': sb.append("\\n"); break; + case '\r': sb.append("\\r"); break; + case '\t': sb.append("\\t"); break; + default: + if (c < ' ') { + sb.append(String.format("\\u%04x", (int) c)); + } else { + sb.append(c); + } + } + } + return sb.toString(); + } + + // Simple JSON parsing + @SuppressWarnings("unchecked") + private Object parseJson(String json) { + return new JsonParser(json).parse(); + } + + private static class JsonParser { + private final String json; + private int pos = 0; + + JsonParser(String json) { + this.json = json; + } + + Object parse() { + skipWhitespace(); + return parseValue(); + } + + private Object parseValue() { + skipWhitespace(); + char c = peek(); + if (c == '{') return parseObject(); + if (c == '[') return parseArray(); + if (c == '"') return parseString(); + if (c == 't' || c == 'f') return parseBoolean(); + if (c == 'n') return parseNull(); + if (c == '-' || Character.isDigit(c)) return parseNumber(); + throw new RuntimeException("Unexpected character: " + c + " at position " + pos); + } + + private Map parseObject() { + expect('{'); + Map map = new LinkedHashMap<>(); + skipWhitespace(); + if (peek() != '}') { + do { + skipWhitespace(); + String key = parseString(); + skipWhitespace(); + expect(':'); + Object value = parseValue(); + map.put(key, value); + skipWhitespace(); + } while (tryConsume(',')); + } + expect('}'); + return map; + } + + private List parseArray() { + expect('['); + List list = new ArrayList<>(); + skipWhitespace(); + if (peek() != ']') { + do { + list.add(parseValue()); + skipWhitespace(); + } while (tryConsume(',')); + } + expect(']'); + return list; + } + + private String parseString() { + expect('"'); + StringBuilder sb = new StringBuilder(); + while (pos < json.length()) { + char c = json.charAt(pos++); + if (c == '"') return sb.toString(); + if (c == '\\') { + c = json.charAt(pos++); + switch (c) { + case '"': case '\\': case '/': sb.append(c); break; + case 'b': sb.append('\b'); break; + case 'f': sb.append('\f'); break; + case 'n': sb.append('\n'); break; + case 'r': sb.append('\r'); break; + case 't': sb.append('\t'); break; + case 'u': + String hex = json.substring(pos, pos + 4); + sb.append((char) Integer.parseInt(hex, 16)); + pos += 4; + break; + } + } else { + sb.append(c); + } + } + throw new RuntimeException("Unterminated string"); + } + + private Number parseNumber() { + int start = pos; + if (peek() == '-') pos++; + while (pos < json.length() && Character.isDigit(json.charAt(pos))) pos++; + if (pos < json.length() && json.charAt(pos) == '.') { + pos++; + while (pos < json.length() && Character.isDigit(json.charAt(pos))) pos++; + } + if (pos < json.length() && (json.charAt(pos) == 'e' || json.charAt(pos) == 'E')) { + pos++; + if (pos < json.length() && (json.charAt(pos) == '+' || json.charAt(pos) == '-')) pos++; + while (pos < json.length() && Character.isDigit(json.charAt(pos))) pos++; + } + String numStr = json.substring(start, pos); + if (numStr.contains(".") || numStr.contains("e") || numStr.contains("E")) { + return Double.parseDouble(numStr); + } + long l = Long.parseLong(numStr); + if (l >= Integer.MIN_VALUE && l <= Integer.MAX_VALUE) { + return (int) l; + } + return l; + } + + private Boolean parseBoolean() { + if (json.startsWith("true", pos)) { + pos += 4; + return true; + } + if (json.startsWith("false", pos)) { + pos += 5; + return false; + } + throw new RuntimeException("Expected boolean at position " + pos); + } + + private Object parseNull() { + if (json.startsWith("null", pos)) { + pos += 4; + return null; + } + throw new RuntimeException("Expected null at position " + pos); + } + + private void skipWhitespace() { + while (pos < json.length() && Character.isWhitespace(json.charAt(pos))) pos++; + } + + private char peek() { + return pos < json.length() ? json.charAt(pos) : '\0'; + } + + private void expect(char c) { + skipWhitespace(); + if (pos >= json.length() || json.charAt(pos) != c) { + throw new RuntimeException("Expected '" + c + "' at position " + pos); + } + pos++; + } + + private boolean tryConsume(char c) { + skipWhitespace(); + if (pos < json.length() && json.charAt(pos) == c) { + pos++; + return true; + } + return false; + } + } + + private void debug(String message) { + if (DEBUG) { + System.err.println("[Java ATS] " + message); } - throw new IllegalArgumentException("Unknown value: " + value); } } -/** EndpointProperty enum. */ -enum EndpointProperty { - URL("Url"), - HOST("Host"), - IPV4_HOST("IPV4Host"), - PORT("Port"), - SCHEME("Scheme"), - TARGET_PORT("TargetPort"), - HOST_AND_PORT("HostAndPort"), - TLS_ENABLED("TlsEnabled"); +// ===== AspireDict.java ===== +// AspireDict.java - GENERATED CODE - DO NOT EDIT - private final String value; +package aspire; - EndpointProperty(String value) { - this.value = value; +import java.util.*; + +/** + * AspireDict is a handle-backed dictionary with lazy handle resolution. + */ +public class AspireDict extends HandleWrapperBase { + private final String getterCapabilityId; + private Handle resolvedHandle; + + AspireDict(Handle handle, AspireClient client) { + super(handle, client); + this.getterCapabilityId = null; + this.resolvedHandle = handle; } - public String getValue() { return value; } + AspireDict(Handle contextHandle, AspireClient client, String getterCapabilityId) { + super(contextHandle, client); + this.getterCapabilityId = getterCapabilityId; + this.resolvedHandle = null; + } - public static EndpointProperty fromValue(String value) { - for (EndpointProperty e : values()) { - if (e.value.equals(value)) return e; + private Handle ensureHandle() { + if (resolvedHandle != null) { + return resolvedHandle; } - throw new IllegalArgumentException("Unknown value: " + value); + if (getterCapabilityId != null) { + Map args = new HashMap<>(); + args.put("context", getHandle().toJson()); + Object result = getClient().invokeCapability(getterCapabilityId, args); + if (result instanceof Handle handle) { + resolvedHandle = handle; + } + } + if (resolvedHandle == null) { + resolvedHandle = getHandle(); + } + return resolvedHandle; } } -/** UrlDisplayLocation enum. */ -enum UrlDisplayLocation { - SUMMARY_AND_DETAILS("SummaryAndDetails"), - DETAILS_ONLY("DetailsOnly"); +// ===== AspireFunc0.java ===== +// AspireFunc0.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; + +@FunctionalInterface +public interface AspireFunc0 { + R invoke(); +} + +// ===== AspireFunc1.java ===== +// AspireFunc1.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; + +@FunctionalInterface +public interface AspireFunc1 { + R invoke(T1 arg1); +} + +// ===== AspireFunc2.java ===== +// AspireFunc2.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; + +@FunctionalInterface +public interface AspireFunc2 { + R invoke(T1 arg1, T2 arg2); +} + +// ===== AspireFunc3.java ===== +// AspireFunc3.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; + +@FunctionalInterface +public interface AspireFunc3 { + R invoke(T1 arg1, T2 arg2, T3 arg3); +} + +// ===== AspireFunc4.java ===== +// AspireFunc4.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; + +@FunctionalInterface +public interface AspireFunc4 { + R invoke(T1 arg1, T2 arg2, T3 arg3, T4 arg4); +} + +// ===== AspireList.java ===== +// AspireList.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; + +/** + * AspireList is a handle-backed list with lazy handle resolution. + */ +public class AspireList extends HandleWrapperBase { + private final String getterCapabilityId; + private Handle resolvedHandle; + + AspireList(Handle handle, AspireClient client) { + super(handle, client); + this.getterCapabilityId = null; + this.resolvedHandle = handle; + } + + AspireList(Handle contextHandle, AspireClient client, String getterCapabilityId) { + super(contextHandle, client); + this.getterCapabilityId = getterCapabilityId; + this.resolvedHandle = null; + } + + private Handle ensureHandle() { + if (resolvedHandle != null) { + return resolvedHandle; + } + if (getterCapabilityId != null) { + Map args = new HashMap<>(); + args.put("context", getHandle().toJson()); + Object result = getClient().invokeCapability(getterCapabilityId, args); + if (result instanceof Handle handle) { + resolvedHandle = handle; + } + } + if (resolvedHandle == null) { + resolvedHandle = getHandle(); + } + return resolvedHandle; + } +} + +// ===== AspireRegistrations.java ===== +// AspireRegistrations.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Static initializer to register handle wrappers. */ +public class AspireRegistrations { + static { + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder", (h, c) -> new IDistributedApplicationBuilder(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.DistributedApplication", (h, c) -> new DistributedApplication(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference", (h, c) -> new EndpointReference(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource", (h, c) -> new IResource(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment", (h, c) -> new IResourceWithEnvironment(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints", (h, c) -> new IResourceWithEndpoints(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs", (h, c) -> new IResourceWithArgs(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString", (h, c) -> new IResourceWithConnectionString(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport", (h, c) -> new IResourceWithWaitSupport(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithParent", (h, c) -> new IResourceWithParent(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource", (h, c) -> new ContainerResource(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource", (h, c) -> new ExecutableResource(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource", (h, c) -> new ProjectResource(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource", (h, c) -> new ParameterResource(h, c)); + AspireClient.registerHandleWrapper("System.ComponentModel/System.IServiceProvider", (h, c) -> new IServiceProvider(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService", (h, c) -> new ResourceNotificationService(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService", (h, c) -> new ResourceLoggerService(h, c)); + AspireClient.registerHandleWrapper("Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration", (h, c) -> new IConfiguration(h, c)); + AspireClient.registerHandleWrapper("Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfigurationSection", (h, c) -> new IConfigurationSection(h, c)); + AspireClient.registerHandleWrapper("Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment", (h, c) -> new IHostEnvironment(h, c)); + AspireClient.registerHandleWrapper("Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger", (h, c) -> new ILogger(h, c)); + AspireClient.registerHandleWrapper("Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILoggerFactory", (h, c) -> new ILoggerFactory(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingStep", (h, c) -> new IReportingStep(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingTask", (h, c) -> new IReportingTask(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.Eventing.DistributedApplicationEventSubscription", (h, c) -> new DistributedApplicationEventSubscription(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext", (h, c) -> new DistributedApplicationExecutionContext(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContextOptions", (h, c) -> new DistributedApplicationExecutionContextOptions(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions", (h, c) -> new ProjectResourceOptions(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.IUserSecretsManager", (h, c) -> new IUserSecretsManager(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext", (h, c) -> new PipelineConfigurationContext(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineContext", (h, c) -> new PipelineContext(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep", (h, c) -> new PipelineStep(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext", (h, c) -> new PipelineStepContext(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepFactoryContext", (h, c) -> new PipelineStepFactoryContext(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineSummary", (h, c) -> new PipelineSummary(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.Eventing.DistributedApplicationResourceEventSubscription", (h, c) -> new DistributedApplicationResourceEventSubscription(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEvent", (h, c) -> new IDistributedApplicationEvent(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationResourceEvent", (h, c) -> new IDistributedApplicationResourceEvent(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing", (h, c) -> new IDistributedApplicationEventing(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.AfterResourcesCreatedEvent", (h, c) -> new AfterResourcesCreatedEvent(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent", (h, c) -> new BeforeResourceStartedEvent(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeStartEvent", (h, c) -> new BeforeStartEvent(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext", (h, c) -> new CommandLineArgsCallbackContext(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent", (h, c) -> new ConnectionStringAvailableEvent(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel", (h, c) -> new DistributedApplicationModel(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression", (h, c) -> new EndpointReferenceExpression(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext", (h, c) -> new EnvironmentCallbackContext(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent", (h, c) -> new InitializeResourceEvent(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder", (h, c) -> new ReferenceExpressionBuilder(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.UpdateCommandStateContext", (h, c) -> new UpdateCommandStateContext(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext", (h, c) -> new ExecuteCommandContext(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent", (h, c) -> new ResourceEndpointsAllocatedEvent(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceReadyEvent", (h, c) -> new ResourceReadyEvent(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceStoppedEvent", (h, c) -> new ResourceStoppedEvent(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext", (h, c) -> new ResourceUrlsCallbackContext(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ConnectionStringResource", (h, c) -> new ConnectionStringResource(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource", (h, c) -> new ContainerRegistryResource(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource", (h, c) -> new DotnetToolResource(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ExternalServiceResource", (h, c) -> new ExternalServiceResource(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource", (h, c) -> new CSharpAppResource(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles", (h, c) -> new IResourceWithContainerFiles(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestCallbackContext", (h, c) -> new TestCallbackContext(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestResourceContext", (h, c) -> new TestResourceContext(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestEnvironmentContext", (h, c) -> new TestEnvironmentContext(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestCollectionContext", (h, c) -> new TestCollectionContext(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestRedisResource", (h, c) -> new TestRedisResource(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestDatabaseResource", (h, c) -> new TestDatabaseResource(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestVaultResource", (h, c) -> new TestVaultResource(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.ITestVaultResource", (h, c) -> new ITestVaultResource(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource", (h, c) -> new IContainerFilesDestinationResource(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource", (h, c) -> new IComputeResource(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/List", (h, c) -> new AspireList(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Dict", (h, c) -> new AspireDict(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/List", (h, c) -> new AspireList(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Dict", (h, c) -> new AspireDict(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/List", (h, c) -> new AspireList(h, c)); + AspireClient.registerHandleWrapper("Aspire.Hosting/Dict", (h, c) -> new AspireDict(h, c)); + } + + static void ensureRegistered() { + // Called to trigger static initializer + } +} + +// ===== AspireUnion.java ===== +// AspireUnion.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; + +/** + * Represents a runtime union value for generated Java APIs. + */ +public final class AspireUnion { + private final Object value; + + private AspireUnion(Object value) { + this.value = value; + } + + static AspireUnion of(Object value) { + return value instanceof AspireUnion union ? union : new AspireUnion(value); + } + + static AspireUnion fromValue(Object value) { + return of(value); + } + + Object getValue() { + return value; + } + + boolean is(Class type) { + return value != null && type.isInstance(value); + } + + T getValueAs(Class type) { + if (value == null) { + return null; + } + if (!type.isInstance(value)) { + throw new IllegalStateException("Union value is of type " + value.getClass().getName() + ", not " + type.getName()); + } + return type.cast(value); + } + + @Override + public String toString() { + return "AspireUnion{" + value + "}"; + } +} + +// ===== BaseRegistrations.java ===== +// BaseRegistrations.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; + +/** + * Registers runtime-owned wrappers defined in Base.java. + */ +public final class BaseRegistrations { + private BaseRegistrations() { + } + + static { + AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpression", ReferenceExpression::new); + } + + static void ensureRegistered() { + } +} + +// ===== BeforeResourceStartedEvent.java ===== +// BeforeResourceStartedEvent.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent. */ +public class BeforeResourceStartedEvent extends HandleWrapperBase { + BeforeResourceStartedEvent(Handle handle, AspireClient client) { + super(handle, client); + } + + /** Gets the Resource property */ + public IResource resource() { + Map reqArgs = new HashMap<>(); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (IResource) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.resource", reqArgs); + } + + /** Gets the Services property */ + public IServiceProvider services() { + Map reqArgs = new HashMap<>(); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (IServiceProvider) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.services", reqArgs); + } + +} + +// ===== BeforeStartEvent.java ===== +// BeforeStartEvent.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeStartEvent. */ +public class BeforeStartEvent extends HandleWrapperBase { + BeforeStartEvent(Handle handle, AspireClient client) { + super(handle, client); + } + + /** Gets the Services property */ + public IServiceProvider services() { + Map reqArgs = new HashMap<>(); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (IServiceProvider) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/BeforeStartEvent.services", reqArgs); + } + + /** Gets the Model property */ + public DistributedApplicationModel model() { + Map reqArgs = new HashMap<>(); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (DistributedApplicationModel) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/BeforeStartEvent.model", reqArgs); + } + +} + +// ===== CSharpAppResource.java ===== +// CSharpAppResource.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource. */ +public class CSharpAppResource extends ResourceBuilderBase { + CSharpAppResource(Handle handle, AspireClient client) { + super(handle, client); + } + + /** Configures a resource to use a container registry */ + public CSharpAppResource withContainerRegistry(IResource registry) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("registry", AspireClient.serializeValue(registry)); + getClient().invokeCapability("Aspire.Hosting/withContainerRegistry", reqArgs); + return this; + } + + public CSharpAppResource withContainerRegistry(ResourceBuilderBase registry) { + return withContainerRegistry(new IResource(registry.getHandle(), registry.getClient())); + } + + /** Sets the base image for a Dockerfile build */ + public CSharpAppResource withDockerfileBaseImage(WithDockerfileBaseImageOptions options) { + var buildImage = options == null ? null : options.getBuildImage(); + var runtimeImage = options == null ? null : options.getRuntimeImage(); + return withDockerfileBaseImageImpl(buildImage, runtimeImage); + } + + public CSharpAppResource withDockerfileBaseImage() { + return withDockerfileBaseImage(null); + } + + /** Sets the base image for a Dockerfile build */ + private CSharpAppResource withDockerfileBaseImageImpl(String buildImage, String runtimeImage) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + if (buildImage != null) { + reqArgs.put("buildImage", AspireClient.serializeValue(buildImage)); + } + if (runtimeImage != null) { + reqArgs.put("runtimeImage", AspireClient.serializeValue(runtimeImage)); + } + getClient().invokeCapability("Aspire.Hosting/withDockerfileBaseImage", reqArgs); + return this; + } + + /** Configures an MCP server endpoint on the resource */ + public CSharpAppResource withMcpServer(WithMcpServerOptions options) { + var path = options == null ? null : options.getPath(); + var endpointName = options == null ? null : options.getEndpointName(); + return withMcpServerImpl(path, endpointName); + } + + public CSharpAppResource withMcpServer() { + return withMcpServer(null); + } + + /** Configures an MCP server endpoint on the resource */ + private CSharpAppResource withMcpServerImpl(String path, String endpointName) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + if (path != null) { + reqArgs.put("path", AspireClient.serializeValue(path)); + } + if (endpointName != null) { + reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + } + getClient().invokeCapability("Aspire.Hosting/withMcpServer", reqArgs); + return this; + } + + /** Configures OTLP telemetry export */ + public CSharpAppResource withOtlpExporter() { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + getClient().invokeCapability("Aspire.Hosting/withOtlpExporter", reqArgs); + return this; + } + + /** Configures OTLP telemetry export with specific protocol */ + public CSharpAppResource withOtlpExporterProtocol(OtlpProtocol protocol) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("protocol", AspireClient.serializeValue(protocol)); + getClient().invokeCapability("Aspire.Hosting/withOtlpExporterProtocol", reqArgs); + return this; + } + + /** Sets the number of replicas */ + public CSharpAppResource withReplicas(double replicas) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("replicas", AspireClient.serializeValue(replicas)); + getClient().invokeCapability("Aspire.Hosting/withReplicas", reqArgs); + return this; + } + + /** Disables forwarded headers for the project */ + public CSharpAppResource disableForwardedHeaders() { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + getClient().invokeCapability("Aspire.Hosting/disableForwardedHeaders", reqArgs); + return this; + } + + public CSharpAppResource publishAsDockerFile() { + return publishAsDockerFile(null); + } + + /** Publishes a project as a Docker file with optional container configuration */ + public CSharpAppResource publishAsDockerFile(AspireAction1 configure) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var configureId = configure == null ? null : getClient().registerCallback(args -> { + var obj = (ContainerResource) args[0]; + configure.invoke(obj); + return null; + }); + if (configureId != null) { + reqArgs.put("configure", configureId); + } + getClient().invokeCapability("Aspire.Hosting/publishProjectAsDockerFileWithConfigure", reqArgs); + return this; + } + + public CSharpAppResource withRequiredCommand(String command) { + return withRequiredCommand(command, null); + } + + /** Adds a required command dependency */ + public CSharpAppResource withRequiredCommand(String command, String helpLink) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("command", AspireClient.serializeValue(command)); + if (helpLink != null) { + reqArgs.put("helpLink", AspireClient.serializeValue(helpLink)); + } + getClient().invokeCapability("Aspire.Hosting/withRequiredCommand", reqArgs); + return this; + } + + /** Sets an environment variable */ + public CSharpAppResource withEnvironment(String name, String value) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("value", AspireClient.serializeValue(value)); + getClient().invokeCapability("Aspire.Hosting/withEnvironment", reqArgs); + return this; + } + + /** Adds an environment variable with a reference expression */ + public CSharpAppResource withEnvironmentExpression(String name, ReferenceExpression value) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("value", AspireClient.serializeValue(value)); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentExpression", reqArgs); + return this; + } + + /** Sets environment variables via callback */ + public CSharpAppResource withEnvironmentCallback(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var obj = (EnvironmentCallbackContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withEnvironmentCallback", reqArgs); + return this; + } + + /** Sets environment variables via async callback */ + public CSharpAppResource withEnvironmentCallbackAsync(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (EnvironmentCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withEnvironmentCallbackAsync", reqArgs); + return this; + } + + /** Sets an environment variable from an endpoint reference */ + public CSharpAppResource withEnvironmentEndpoint(String name, EndpointReference endpointReference) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("endpointReference", AspireClient.serializeValue(endpointReference)); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentEndpoint", reqArgs); + return this; + } + + /** Sets an environment variable from a parameter resource */ + public CSharpAppResource withEnvironmentParameter(String name, ParameterResource parameter) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("parameter", AspireClient.serializeValue(parameter)); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentParameter", reqArgs); + return this; + } + + /** Sets an environment variable from a connection string resource */ + public CSharpAppResource withEnvironmentConnectionString(String envVarName, IResourceWithConnectionString resource) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("envVarName", AspireClient.serializeValue(envVarName)); + reqArgs.put("resource", AspireClient.serializeValue(resource)); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentConnectionString", reqArgs); + return this; + } + + public CSharpAppResource withEnvironmentConnectionString(String envVarName, ResourceBuilderBase resource) { + return withEnvironmentConnectionString(envVarName, new IResourceWithConnectionString(resource.getHandle(), resource.getClient())); + } + + /** Adds arguments */ + public CSharpAppResource withArgs(String[] args) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("args", AspireClient.serializeValue(args)); + getClient().invokeCapability("Aspire.Hosting/withArgs", reqArgs); + return this; + } + + /** Sets command-line arguments via callback */ + public CSharpAppResource withArgsCallback(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var obj = (CommandLineArgsCallbackContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withArgsCallback", reqArgs); + return this; + } + + /** Sets command-line arguments via async callback */ + public CSharpAppResource withArgsCallbackAsync(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (CommandLineArgsCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withArgsCallbackAsync", reqArgs); + return this; + } + + /** Adds a reference to another resource */ + public CSharpAppResource withReference(IResource source, WithReferenceOptions options) { + var connectionName = options == null ? null : options.getConnectionName(); + var optional = options == null ? null : options.getOptional(); + var name = options == null ? null : options.getName(); + return withReferenceImpl(source, connectionName, optional, name); + } + + public CSharpAppResource withReference(ResourceBuilderBase source, WithReferenceOptions options) { + return withReference(new IResource(source.getHandle(), source.getClient()), options); + } + + public CSharpAppResource withReference(IResource source) { + return withReference(source, null); + } + + public CSharpAppResource withReference(ResourceBuilderBase source) { + return withReference(new IResource(source.getHandle(), source.getClient())); + } + + /** Adds a reference to another resource */ + private CSharpAppResource withReferenceImpl(IResource source, String connectionName, Boolean optional, String name) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("source", AspireClient.serializeValue(source)); + if (connectionName != null) { + reqArgs.put("connectionName", AspireClient.serializeValue(connectionName)); + } + if (optional != null) { + reqArgs.put("optional", AspireClient.serializeValue(optional)); + } + if (name != null) { + reqArgs.put("name", AspireClient.serializeValue(name)); + } + getClient().invokeCapability("Aspire.Hosting/withReference", reqArgs); + return this; + } + + /** Adds a reference to a URI */ + public CSharpAppResource withReferenceUri(String name, String uri) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("uri", AspireClient.serializeValue(uri)); + getClient().invokeCapability("Aspire.Hosting/withReferenceUri", reqArgs); + return this; + } + + /** Adds a reference to an external service */ + public CSharpAppResource withReferenceExternalService(ExternalServiceResource externalService) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("externalService", AspireClient.serializeValue(externalService)); + getClient().invokeCapability("Aspire.Hosting/withReferenceExternalService", reqArgs); + return this; + } + + /** Adds a reference to an endpoint */ + public CSharpAppResource withReferenceEndpoint(EndpointReference endpointReference) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("endpointReference", AspireClient.serializeValue(endpointReference)); + getClient().invokeCapability("Aspire.Hosting/withReferenceEndpoint", reqArgs); + return this; + } + + /** Adds a network endpoint */ + public CSharpAppResource withEndpoint(WithEndpointOptions options) { + var port = options == null ? null : options.getPort(); + var targetPort = options == null ? null : options.getTargetPort(); + var scheme = options == null ? null : options.getScheme(); + var name = options == null ? null : options.getName(); + var env = options == null ? null : options.getEnv(); + var isProxied = options == null ? null : options.isProxied(); + var isExternal = options == null ? null : options.isExternal(); + var protocol = options == null ? null : options.getProtocol(); + return withEndpointImpl(port, targetPort, scheme, name, env, isProxied, isExternal, protocol); + } + + public CSharpAppResource withEndpoint() { + return withEndpoint(null); + } + + /** Adds a network endpoint */ + private CSharpAppResource withEndpointImpl(Double port, Double targetPort, String scheme, String name, String env, Boolean isProxied, Boolean isExternal, ProtocolType protocol) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + if (port != null) { + reqArgs.put("port", AspireClient.serializeValue(port)); + } + if (targetPort != null) { + reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); + } + if (scheme != null) { + reqArgs.put("scheme", AspireClient.serializeValue(scheme)); + } + if (name != null) { + reqArgs.put("name", AspireClient.serializeValue(name)); + } + if (env != null) { + reqArgs.put("env", AspireClient.serializeValue(env)); + } + if (isProxied != null) { + reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); + } + if (isExternal != null) { + reqArgs.put("isExternal", AspireClient.serializeValue(isExternal)); + } + if (protocol != null) { + reqArgs.put("protocol", AspireClient.serializeValue(protocol)); + } + getClient().invokeCapability("Aspire.Hosting/withEndpoint", reqArgs); + return this; + } + + /** Adds an HTTP endpoint */ + public CSharpAppResource withHttpEndpoint(WithHttpEndpointOptions options) { + var port = options == null ? null : options.getPort(); + var targetPort = options == null ? null : options.getTargetPort(); + var name = options == null ? null : options.getName(); + var env = options == null ? null : options.getEnv(); + var isProxied = options == null ? null : options.isProxied(); + return withHttpEndpointImpl(port, targetPort, name, env, isProxied); + } + + public CSharpAppResource withHttpEndpoint() { + return withHttpEndpoint(null); + } + + /** Adds an HTTP endpoint */ + private CSharpAppResource withHttpEndpointImpl(Double port, Double targetPort, String name, String env, Boolean isProxied) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + if (port != null) { + reqArgs.put("port", AspireClient.serializeValue(port)); + } + if (targetPort != null) { + reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); + } + if (name != null) { + reqArgs.put("name", AspireClient.serializeValue(name)); + } + if (env != null) { + reqArgs.put("env", AspireClient.serializeValue(env)); + } + if (isProxied != null) { + reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); + } + getClient().invokeCapability("Aspire.Hosting/withHttpEndpoint", reqArgs); + return this; + } + + /** Adds an HTTPS endpoint */ + public CSharpAppResource withHttpsEndpoint(WithHttpsEndpointOptions options) { + var port = options == null ? null : options.getPort(); + var targetPort = options == null ? null : options.getTargetPort(); + var name = options == null ? null : options.getName(); + var env = options == null ? null : options.getEnv(); + var isProxied = options == null ? null : options.isProxied(); + return withHttpsEndpointImpl(port, targetPort, name, env, isProxied); + } + + public CSharpAppResource withHttpsEndpoint() { + return withHttpsEndpoint(null); + } + + /** Adds an HTTPS endpoint */ + private CSharpAppResource withHttpsEndpointImpl(Double port, Double targetPort, String name, String env, Boolean isProxied) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + if (port != null) { + reqArgs.put("port", AspireClient.serializeValue(port)); + } + if (targetPort != null) { + reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); + } + if (name != null) { + reqArgs.put("name", AspireClient.serializeValue(name)); + } + if (env != null) { + reqArgs.put("env", AspireClient.serializeValue(env)); + } + if (isProxied != null) { + reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); + } + getClient().invokeCapability("Aspire.Hosting/withHttpsEndpoint", reqArgs); + return this; + } + + /** Makes HTTP endpoints externally accessible */ + public CSharpAppResource withExternalHttpEndpoints() { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + getClient().invokeCapability("Aspire.Hosting/withExternalHttpEndpoints", reqArgs); + return this; + } + + /** Gets an endpoint reference */ + public EndpointReference getEndpoint(String name) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("name", AspireClient.serializeValue(name)); + return (EndpointReference) getClient().invokeCapability("Aspire.Hosting/getEndpoint", reqArgs); + } + + /** Configures resource for HTTP/2 */ + public CSharpAppResource asHttp2Service() { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + getClient().invokeCapability("Aspire.Hosting/asHttp2Service", reqArgs); + return this; + } + + /** Customizes displayed URLs via callback */ + public CSharpAppResource withUrlsCallback(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var obj = (ResourceUrlsCallbackContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withUrlsCallback", reqArgs); + return this; + } + + /** Customizes displayed URLs via async callback */ + public CSharpAppResource withUrlsCallbackAsync(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceUrlsCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withUrlsCallbackAsync", reqArgs); + return this; + } + + public CSharpAppResource withUrl(String url) { + return withUrl(url, null); + } + + /** Adds or modifies displayed URLs */ + public CSharpAppResource withUrl(String url, String displayText) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("url", AspireClient.serializeValue(url)); + if (displayText != null) { + reqArgs.put("displayText", AspireClient.serializeValue(displayText)); + } + getClient().invokeCapability("Aspire.Hosting/withUrl", reqArgs); + return this; + } + + public CSharpAppResource withUrlExpression(ReferenceExpression url) { + return withUrlExpression(url, null); + } + + /** Adds a URL using a reference expression */ + public CSharpAppResource withUrlExpression(ReferenceExpression url, String displayText) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("url", AspireClient.serializeValue(url)); + if (displayText != null) { + reqArgs.put("displayText", AspireClient.serializeValue(displayText)); + } + getClient().invokeCapability("Aspire.Hosting/withUrlExpression", reqArgs); + return this; + } + + /** Customizes the URL for a specific endpoint via callback */ + public CSharpAppResource withUrlForEndpoint(String endpointName, AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + var callbackId = getClient().registerCallback(args -> { + var obj = (ResourceUrlAnnotation) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withUrlForEndpoint", reqArgs); + return this; + } + + /** Adds a URL for a specific endpoint via factory callback */ + public CSharpAppResource withUrlForEndpointFactory(String endpointName, AspireFunc1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + var callbackId = getClient().registerCallback(args -> { + var arg = (EndpointReference) args[0]; + return AspireClient.awaitValue(callback.invoke(arg)); + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withUrlForEndpointFactory", reqArgs); + return this; + } + + /** Configures the resource to copy container files from the specified source during publishing */ + public CSharpAppResource publishWithContainerFiles(IResourceWithContainerFiles source, String destinationPath) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("source", AspireClient.serializeValue(source)); + reqArgs.put("destinationPath", AspireClient.serializeValue(destinationPath)); + getClient().invokeCapability("Aspire.Hosting/publishWithContainerFiles", reqArgs); + return this; + } + + public CSharpAppResource publishWithContainerFiles(ResourceBuilderBase source, String destinationPath) { + return publishWithContainerFiles(new IResourceWithContainerFiles(source.getHandle(), source.getClient()), destinationPath); + } + + /** Excludes the resource from the deployment manifest */ + public CSharpAppResource excludeFromManifest() { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + getClient().invokeCapability("Aspire.Hosting/excludeFromManifest", reqArgs); + return this; + } + + /** Waits for another resource to be ready */ + public CSharpAppResource waitFor(IResource dependency) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + getClient().invokeCapability("Aspire.Hosting/waitFor", reqArgs); + return this; + } + + public CSharpAppResource waitFor(ResourceBuilderBase dependency) { + return waitFor(new IResource(dependency.getHandle(), dependency.getClient())); + } + + /** Waits for another resource with specific behavior */ + public CSharpAppResource waitForWithBehavior(IResource dependency, WaitBehavior waitBehavior) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + reqArgs.put("waitBehavior", AspireClient.serializeValue(waitBehavior)); + getClient().invokeCapability("Aspire.Hosting/waitForWithBehavior", reqArgs); + return this; + } + + public CSharpAppResource waitForWithBehavior(ResourceBuilderBase dependency, WaitBehavior waitBehavior) { + return waitForWithBehavior(new IResource(dependency.getHandle(), dependency.getClient()), waitBehavior); + } + + /** Waits for another resource to start */ + public CSharpAppResource waitForStart(IResource dependency) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + getClient().invokeCapability("Aspire.Hosting/waitForStart", reqArgs); + return this; + } + + public CSharpAppResource waitForStart(ResourceBuilderBase dependency) { + return waitForStart(new IResource(dependency.getHandle(), dependency.getClient())); + } + + /** Waits for another resource to start with specific behavior */ + public CSharpAppResource waitForStartWithBehavior(IResource dependency, WaitBehavior waitBehavior) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + reqArgs.put("waitBehavior", AspireClient.serializeValue(waitBehavior)); + getClient().invokeCapability("Aspire.Hosting/waitForStartWithBehavior", reqArgs); + return this; + } + + public CSharpAppResource waitForStartWithBehavior(ResourceBuilderBase dependency, WaitBehavior waitBehavior) { + return waitForStartWithBehavior(new IResource(dependency.getHandle(), dependency.getClient()), waitBehavior); + } + + /** Prevents resource from starting automatically */ + public CSharpAppResource withExplicitStart() { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + getClient().invokeCapability("Aspire.Hosting/withExplicitStart", reqArgs); + return this; + } + + public CSharpAppResource waitForCompletion(IResource dependency) { + return waitForCompletion(dependency, null); + } + + public CSharpAppResource waitForCompletion(ResourceBuilderBase dependency) { + return waitForCompletion(new IResource(dependency.getHandle(), dependency.getClient())); + } + + /** Waits for resource completion */ + public CSharpAppResource waitForCompletion(IResource dependency, Double exitCode) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + if (exitCode != null) { + reqArgs.put("exitCode", AspireClient.serializeValue(exitCode)); + } + getClient().invokeCapability("Aspire.Hosting/waitForCompletion", reqArgs); + return this; + } + + public CSharpAppResource waitForCompletion(ResourceBuilderBase dependency, Double exitCode) { + return waitForCompletion(new IResource(dependency.getHandle(), dependency.getClient()), exitCode); + } + + /** Adds a health check by key */ + public CSharpAppResource withHealthCheck(String key) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("key", AspireClient.serializeValue(key)); + getClient().invokeCapability("Aspire.Hosting/withHealthCheck", reqArgs); + return this; + } + + /** Adds an HTTP health check */ + public CSharpAppResource withHttpHealthCheck(WithHttpHealthCheckOptions options) { + var path = options == null ? null : options.getPath(); + var statusCode = options == null ? null : options.getStatusCode(); + var endpointName = options == null ? null : options.getEndpointName(); + return withHttpHealthCheckImpl(path, statusCode, endpointName); + } + + public CSharpAppResource withHttpHealthCheck() { + return withHttpHealthCheck(null); + } + + /** Adds an HTTP health check */ + private CSharpAppResource withHttpHealthCheckImpl(String path, Double statusCode, String endpointName) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + if (path != null) { + reqArgs.put("path", AspireClient.serializeValue(path)); + } + if (statusCode != null) { + reqArgs.put("statusCode", AspireClient.serializeValue(statusCode)); + } + if (endpointName != null) { + reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + } + getClient().invokeCapability("Aspire.Hosting/withHttpHealthCheck", reqArgs); + return this; + } + + public CSharpAppResource withCommand(String name, String displayName, AspireFunc1 executeCommand) { + return withCommand(name, displayName, executeCommand, null); + } + + /** Adds a resource command */ + public CSharpAppResource withCommand(String name, String displayName, AspireFunc1 executeCommand, CommandOptions commandOptions) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("displayName", AspireClient.serializeValue(displayName)); + var executeCommandId = getClient().registerCallback(args -> { + var arg = (ExecuteCommandContext) args[0]; + return AspireClient.awaitValue(executeCommand.invoke(arg)); + }); + if (executeCommandId != null) { + reqArgs.put("executeCommand", executeCommandId); + } + if (commandOptions != null) { + reqArgs.put("commandOptions", AspireClient.serializeValue(commandOptions)); + } + getClient().invokeCapability("Aspire.Hosting/withCommand", reqArgs); + return this; + } + + /** Configures developer certificate trust */ + public CSharpAppResource withDeveloperCertificateTrust(boolean trust) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("trust", AspireClient.serializeValue(trust)); + getClient().invokeCapability("Aspire.Hosting/withDeveloperCertificateTrust", reqArgs); + return this; + } + + /** Sets the certificate trust scope */ + public CSharpAppResource withCertificateTrustScope(CertificateTrustScope scope) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("scope", AspireClient.serializeValue(scope)); + getClient().invokeCapability("Aspire.Hosting/withCertificateTrustScope", reqArgs); + return this; + } + + public CSharpAppResource withHttpsDeveloperCertificate() { + return withHttpsDeveloperCertificate(null); + } + + /** Configures HTTPS with a developer certificate */ + public CSharpAppResource withHttpsDeveloperCertificate(ParameterResource password) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + if (password != null) { + reqArgs.put("password", AspireClient.serializeValue(password)); + } + getClient().invokeCapability("Aspire.Hosting/withHttpsDeveloperCertificate", reqArgs); + return this; + } + + /** Removes HTTPS certificate configuration */ + public CSharpAppResource withoutHttpsCertificate() { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + getClient().invokeCapability("Aspire.Hosting/withoutHttpsCertificate", reqArgs); + return this; + } + + /** Sets the parent relationship */ + public CSharpAppResource withParentRelationship(IResource parent) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("parent", AspireClient.serializeValue(parent)); + getClient().invokeCapability("Aspire.Hosting/withParentRelationship", reqArgs); + return this; + } + + public CSharpAppResource withParentRelationship(ResourceBuilderBase parent) { + return withParentRelationship(new IResource(parent.getHandle(), parent.getClient())); + } + + /** Sets a child relationship */ + public CSharpAppResource withChildRelationship(IResource child) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("child", AspireClient.serializeValue(child)); + getClient().invokeCapability("Aspire.Hosting/withChildRelationship", reqArgs); + return this; + } + + public CSharpAppResource withChildRelationship(ResourceBuilderBase child) { + return withChildRelationship(new IResource(child.getHandle(), child.getClient())); + } + + public CSharpAppResource withIconName(String iconName) { + return withIconName(iconName, null); + } + + /** Sets the icon for the resource */ + public CSharpAppResource withIconName(String iconName, IconVariant iconVariant) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("iconName", AspireClient.serializeValue(iconName)); + if (iconVariant != null) { + reqArgs.put("iconVariant", AspireClient.serializeValue(iconVariant)); + } + getClient().invokeCapability("Aspire.Hosting/withIconName", reqArgs); + return this; + } + + /** Adds an HTTP health probe to the resource */ + public CSharpAppResource withHttpProbe(ProbeType probeType, WithHttpProbeOptions options) { + var path = options == null ? null : options.getPath(); + var initialDelaySeconds = options == null ? null : options.getInitialDelaySeconds(); + var periodSeconds = options == null ? null : options.getPeriodSeconds(); + var timeoutSeconds = options == null ? null : options.getTimeoutSeconds(); + var failureThreshold = options == null ? null : options.getFailureThreshold(); + var successThreshold = options == null ? null : options.getSuccessThreshold(); + var endpointName = options == null ? null : options.getEndpointName(); + return withHttpProbeImpl(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName); + } + + public CSharpAppResource withHttpProbe(ProbeType probeType) { + return withHttpProbe(probeType, null); + } + + /** Adds an HTTP health probe to the resource */ + private CSharpAppResource withHttpProbeImpl(ProbeType probeType, String path, Double initialDelaySeconds, Double periodSeconds, Double timeoutSeconds, Double failureThreshold, Double successThreshold, String endpointName) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("probeType", AspireClient.serializeValue(probeType)); + if (path != null) { + reqArgs.put("path", AspireClient.serializeValue(path)); + } + if (initialDelaySeconds != null) { + reqArgs.put("initialDelaySeconds", AspireClient.serializeValue(initialDelaySeconds)); + } + if (periodSeconds != null) { + reqArgs.put("periodSeconds", AspireClient.serializeValue(periodSeconds)); + } + if (timeoutSeconds != null) { + reqArgs.put("timeoutSeconds", AspireClient.serializeValue(timeoutSeconds)); + } + if (failureThreshold != null) { + reqArgs.put("failureThreshold", AspireClient.serializeValue(failureThreshold)); + } + if (successThreshold != null) { + reqArgs.put("successThreshold", AspireClient.serializeValue(successThreshold)); + } + if (endpointName != null) { + reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + } + getClient().invokeCapability("Aspire.Hosting/withHttpProbe", reqArgs); + return this; + } + + /** Excludes the resource from MCP server exposure */ + public CSharpAppResource excludeFromMcp() { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + getClient().invokeCapability("Aspire.Hosting/excludeFromMcp", reqArgs); + return this; + } + + /** Sets the remote image name for publishing */ + public CSharpAppResource withRemoteImageName(String remoteImageName) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("remoteImageName", AspireClient.serializeValue(remoteImageName)); + getClient().invokeCapability("Aspire.Hosting/withRemoteImageName", reqArgs); + return this; + } + + /** Sets the remote image tag for publishing */ + public CSharpAppResource withRemoteImageTag(String remoteImageTag) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("remoteImageTag", AspireClient.serializeValue(remoteImageTag)); + getClient().invokeCapability("Aspire.Hosting/withRemoteImageTag", reqArgs); + return this; + } + + /** Adds a pipeline step to the resource */ + public CSharpAppResource withPipelineStepFactory(String stepName, AspireAction1 callback, WithPipelineStepFactoryOptions options) { + var dependsOn = options == null ? null : options.getDependsOn(); + var requiredBy = options == null ? null : options.getRequiredBy(); + var tags = options == null ? null : options.getTags(); + var description = options == null ? null : options.getDescription(); + return withPipelineStepFactoryImpl(stepName, callback, dependsOn, requiredBy, tags, description); + } + + public CSharpAppResource withPipelineStepFactory(String stepName, AspireAction1 callback) { + return withPipelineStepFactory(stepName, callback, null); + } + + /** Adds a pipeline step to the resource */ + private CSharpAppResource withPipelineStepFactoryImpl(String stepName, AspireAction1 callback, String[] dependsOn, String[] requiredBy, String[] tags, String description) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("stepName", AspireClient.serializeValue(stepName)); + var callbackId = getClient().registerCallback(args -> { + var arg = (PipelineStepContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + if (dependsOn != null) { + reqArgs.put("dependsOn", AspireClient.serializeValue(dependsOn)); + } + if (requiredBy != null) { + reqArgs.put("requiredBy", AspireClient.serializeValue(requiredBy)); + } + if (tags != null) { + reqArgs.put("tags", AspireClient.serializeValue(tags)); + } + if (description != null) { + reqArgs.put("description", AspireClient.serializeValue(description)); + } + getClient().invokeCapability("Aspire.Hosting/withPipelineStepFactory", reqArgs); + return this; + } + + /** Configures pipeline step dependencies via an async callback */ + public CSharpAppResource withPipelineConfigurationAsync(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (PipelineConfigurationContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withPipelineConfigurationAsync", reqArgs); + return this; + } + + /** Configures pipeline step dependencies via a callback */ + public CSharpAppResource withPipelineConfiguration(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var obj = (PipelineConfigurationContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withPipelineConfiguration", reqArgs); + return this; + } + + /** Gets the resource name */ + public String getResourceName() { + Map reqArgs = new HashMap<>(); + reqArgs.put("resource", AspireClient.serializeValue(getHandle())); + return (String) getClient().invokeCapability("Aspire.Hosting/getResourceName", reqArgs); + } + + /** Subscribes to the BeforeResourceStarted event */ + public CSharpAppResource onBeforeResourceStarted(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (BeforeResourceStartedEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onBeforeResourceStarted", reqArgs); + return this; + } + + /** Subscribes to the ResourceStopped event */ + public CSharpAppResource onResourceStopped(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceStoppedEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onResourceStopped", reqArgs); + return this; + } + + /** Subscribes to the InitializeResource event */ + public CSharpAppResource onInitializeResource(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (InitializeResourceEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onInitializeResource", reqArgs); + return this; + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + public CSharpAppResource onResourceEndpointsAllocated(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceEndpointsAllocatedEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onResourceEndpointsAllocated", reqArgs); + return this; + } + + /** Subscribes to the ResourceReady event */ + public CSharpAppResource onResourceReady(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceReadyEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onResourceReady", reqArgs); + return this; + } + + /** Adds an optional string parameter */ + public CSharpAppResource withOptionalString(WithOptionalStringOptions options) { + var value = options == null ? null : options.getValue(); + var enabled = options == null ? null : options.getEnabled(); + return withOptionalStringImpl(value, enabled); + } + + public CSharpAppResource withOptionalString() { + return withOptionalString(null); + } + + /** Adds an optional string parameter */ + private CSharpAppResource withOptionalStringImpl(String value, Boolean enabled) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + if (value != null) { + reqArgs.put("value", AspireClient.serializeValue(value)); + } + if (enabled != null) { + reqArgs.put("enabled", AspireClient.serializeValue(enabled)); + } + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalString", reqArgs); + return this; + } + + /** Configures the resource with a DTO */ + public CSharpAppResource withConfig(TestConfigDto config) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("config", AspireClient.serializeValue(config)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConfig", reqArgs); + return this; + } + + /** Configures environment with callback (test version) */ + public CSharpAppResource testWithEnvironmentCallback(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (TestEnvironmentContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWithEnvironmentCallback", reqArgs); + return this; + } + + /** Sets the created timestamp */ + public CSharpAppResource withCreatedAt(String createdAt) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("createdAt", AspireClient.serializeValue(createdAt)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCreatedAt", reqArgs); + return this; + } + + /** Sets the modified timestamp */ + public CSharpAppResource withModifiedAt(String modifiedAt) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("modifiedAt", AspireClient.serializeValue(modifiedAt)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withModifiedAt", reqArgs); + return this; + } + + /** Sets the correlation ID */ + public CSharpAppResource withCorrelationId(String correlationId) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("correlationId", AspireClient.serializeValue(correlationId)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCorrelationId", reqArgs); + return this; + } + + public CSharpAppResource withOptionalCallback() { + return withOptionalCallback(null); + } + + /** Configures with optional callback */ + public CSharpAppResource withOptionalCallback(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = callback == null ? null : getClient().registerCallback(args -> { + var arg = (TestCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalCallback", reqArgs); + return this; + } + + /** Sets the resource status */ + public CSharpAppResource withStatus(TestResourceStatus status) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("status", AspireClient.serializeValue(status)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withStatus", reqArgs); + return this; + } + + /** Configures with nested DTO */ + public CSharpAppResource withNestedConfig(TestNestedDto config) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("config", AspireClient.serializeValue(config)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withNestedConfig", reqArgs); + return this; + } + + /** Adds validation callback */ + public CSharpAppResource withValidator(AspireFunc1 validator) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var validatorId = getClient().registerCallback(args -> { + var arg = (TestResourceContext) args[0]; + return AspireClient.awaitValue(validator.invoke(arg)); + }); + if (validatorId != null) { + reqArgs.put("validator", validatorId); + } + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withValidator", reqArgs); + return this; + } + + /** Waits for another resource (test version) */ + public CSharpAppResource testWaitFor(IResource dependency) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWaitFor", reqArgs); + return this; + } + + public CSharpAppResource testWaitFor(ResourceBuilderBase dependency) { + return testWaitFor(new IResource(dependency.getHandle(), dependency.getClient())); + } + + /** Adds a dependency on another resource */ + public CSharpAppResource withDependency(IResourceWithConnectionString dependency) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDependency", reqArgs); + return this; + } + + public CSharpAppResource withDependency(ResourceBuilderBase dependency) { + return withDependency(new IResourceWithConnectionString(dependency.getHandle(), dependency.getClient())); + } + + /** Sets the endpoints */ + public CSharpAppResource withEndpoints(String[] endpoints) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("endpoints", AspireClient.serializeValue(endpoints)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEndpoints", reqArgs); + return this; + } + + /** Sets environment variables */ + public CSharpAppResource withEnvironmentVariables(Map variables) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("variables", AspireClient.serializeValue(variables)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEnvironmentVariables", reqArgs); + return this; + } + + /** Performs a cancellable operation */ + public CSharpAppResource withCancellableOperation(AspireAction1 operation) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var operationId = getClient().registerCallback(args -> { + var arg = CancellationToken.fromValue(args[0]); + operation.invoke(arg); + return null; + }); + if (operationId != null) { + reqArgs.put("operation", operationId); + } + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCancellableOperation", reqArgs); + return this; + } + +} + +// ===== CancellationToken.java ===== +// CancellationToken.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.io.*; +import java.net.*; +import java.nio.charset.StandardCharsets; +import java.util.*; +import java.util.concurrent.*; +import java.util.concurrent.atomic.*; +import java.util.function.*; + +/** + * CancellationToken for cancelling operations. + */ +public class CancellationToken { + private volatile boolean cancelled = false; + private final List listeners = new CopyOnWriteArrayList<>(); + + void cancel() { + cancelled = true; + for (Runnable listener : listeners) { + listener.run(); + } + } + + boolean isCancelled() { return cancelled; } + + void onCancel(Runnable listener) { + listeners.add(listener); + if (cancelled) { + listener.run(); + } + } +} + +// ===== CapabilityError.java ===== +// CapabilityError.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.io.*; +import java.net.*; +import java.nio.charset.StandardCharsets; +import java.util.*; +import java.util.concurrent.*; +import java.util.concurrent.atomic.*; +import java.util.function.*; + +/** + * CapabilityError represents an error from a capability invocation. + */ +public class CapabilityError extends RuntimeException { + private final String code; + private final Object data; + + CapabilityError(String code, String message, Object data) { + super(message); + this.code = code; + this.data = data; + } + + String getCode() { return code; } + Object getData() { return data; } +} + +// ===== CertificateTrustScope.java ===== +// CertificateTrustScope.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** CertificateTrustScope enum. */ +public enum CertificateTrustScope implements WireValueEnum { + NONE("None"), + APPEND("Append"), + OVERRIDE("Override"), + SYSTEM("System"); + + private final String value; + + CertificateTrustScope(String value) { + this.value = value; + } + + public String getValue() { return value; } + + public static CertificateTrustScope fromValue(String value) { + for (CertificateTrustScope e : values()) { + if (e.value.equals(value)) return e; + } + throw new IllegalArgumentException("Unknown value: " + value); + } +} + +// ===== CommandLineArgsCallbackContext.java ===== +// CommandLineArgsCallbackContext.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext. */ +public class CommandLineArgsCallbackContext extends HandleWrapperBase { + CommandLineArgsCallbackContext(Handle handle, AspireClient client) { + super(handle, client); + } + + /** Gets the Args property */ + private AspireList argsField; + public AspireList args() { + if (argsField == null) { + argsField = new AspireList<>(getHandle(), getClient(), "Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.args"); + } + return argsField; + } + + /** Gets the CancellationToken property */ + public CancellationToken cancellationToken() { + Map reqArgs = new HashMap<>(); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (CancellationToken) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.cancellationToken", reqArgs); + } + + /** Gets the ExecutionContext property */ + public DistributedApplicationExecutionContext executionContext() { + Map reqArgs = new HashMap<>(); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (DistributedApplicationExecutionContext) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.executionContext", reqArgs); + } + + /** Sets the ExecutionContext property */ + public CommandLineArgsCallbackContext setExecutionContext(DistributedApplicationExecutionContext value) { + Map reqArgs = new HashMap<>(); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + reqArgs.put("value", AspireClient.serializeValue(value)); + return (CommandLineArgsCallbackContext) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.setExecutionContext", reqArgs); + } + + /** Gets the Logger property */ + public ILogger logger() { + Map reqArgs = new HashMap<>(); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (ILogger) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.logger", reqArgs); + } + + /** Sets the Logger property */ + public CommandLineArgsCallbackContext setLogger(ILogger value) { + Map reqArgs = new HashMap<>(); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + reqArgs.put("value", AspireClient.serializeValue(value)); + return (CommandLineArgsCallbackContext) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.setLogger", reqArgs); + } + + public CommandLineArgsCallbackContext setLogger(HandleWrapperBase value) { + return setLogger(new ILogger(value.getHandle(), value.getClient())); + } + + /** Gets the Resource property */ + public IResource resource() { + Map reqArgs = new HashMap<>(); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (IResource) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.resource", reqArgs); + } + +} + +// ===== CommandOptions.java ===== +// CommandOptions.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** CommandOptions DTO. */ +public class CommandOptions { + private String description; + private Object parameter; + private String confirmationMessage; + private String iconName; + private IconVariant iconVariant; + private boolean isHighlighted; + private Object updateState; + + public String getDescription() { return description; } + public void setDescription(String value) { this.description = value; } + public Object getParameter() { return parameter; } + public void setParameter(Object value) { this.parameter = value; } + public String getConfirmationMessage() { return confirmationMessage; } + public void setConfirmationMessage(String value) { this.confirmationMessage = value; } + public String getIconName() { return iconName; } + public void setIconName(String value) { this.iconName = value; } + public IconVariant getIconVariant() { return iconVariant; } + public void setIconVariant(IconVariant value) { this.iconVariant = value; } + public boolean getIsHighlighted() { return isHighlighted; } + public void setIsHighlighted(boolean value) { this.isHighlighted = value; } + public Object getUpdateState() { return updateState; } + public void setUpdateState(Object value) { this.updateState = value; } + + public Map toMap() { + Map map = new HashMap<>(); + map.put("Description", AspireClient.serializeValue(description)); + map.put("Parameter", AspireClient.serializeValue(parameter)); + map.put("ConfirmationMessage", AspireClient.serializeValue(confirmationMessage)); + map.put("IconName", AspireClient.serializeValue(iconName)); + map.put("IconVariant", AspireClient.serializeValue(iconVariant)); + map.put("IsHighlighted", AspireClient.serializeValue(isHighlighted)); + map.put("UpdateState", AspireClient.serializeValue(updateState)); + return map; + } +} + +// ===== CompleteStepMarkdownOptions.java ===== +// CompleteStepMarkdownOptions.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Options for CompleteStepMarkdown. */ +public final class CompleteStepMarkdownOptions { + private String completionState; + private CancellationToken cancellationToken; + + public String getCompletionState() { return completionState; } + public CompleteStepMarkdownOptions completionState(String value) { + this.completionState = value; + return this; + } + + public CancellationToken getCancellationToken() { return cancellationToken; } + public CompleteStepMarkdownOptions cancellationToken(CancellationToken value) { + this.cancellationToken = value; + return this; + } + +} + +// ===== CompleteStepOptions.java ===== +// CompleteStepOptions.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Options for CompleteStep. */ +public final class CompleteStepOptions { + private String completionState; + private CancellationToken cancellationToken; + + public String getCompletionState() { return completionState; } + public CompleteStepOptions completionState(String value) { + this.completionState = value; + return this; + } + + public CancellationToken getCancellationToken() { return cancellationToken; } + public CompleteStepOptions cancellationToken(CancellationToken value) { + this.cancellationToken = value; + return this; + } + +} + +// ===== CompleteTaskMarkdownOptions.java ===== +// CompleteTaskMarkdownOptions.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Options for CompleteTaskMarkdown. */ +public final class CompleteTaskMarkdownOptions { + private String completionState; + private CancellationToken cancellationToken; + + public String getCompletionState() { return completionState; } + public CompleteTaskMarkdownOptions completionState(String value) { + this.completionState = value; + return this; + } + + public CancellationToken getCancellationToken() { return cancellationToken; } + public CompleteTaskMarkdownOptions cancellationToken(CancellationToken value) { + this.cancellationToken = value; + return this; + } + +} + +// ===== CompleteTaskOptions.java ===== +// CompleteTaskOptions.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Options for CompleteTask. */ +public final class CompleteTaskOptions { + private String completionMessage; + private String completionState; + private CancellationToken cancellationToken; + + public String getCompletionMessage() { return completionMessage; } + public CompleteTaskOptions completionMessage(String value) { + this.completionMessage = value; + return this; + } + + public String getCompletionState() { return completionState; } + public CompleteTaskOptions completionState(String value) { + this.completionState = value; + return this; + } + + public CancellationToken getCancellationToken() { return cancellationToken; } + public CompleteTaskOptions cancellationToken(CancellationToken value) { + this.cancellationToken = value; + return this; + } + +} + +// ===== ConnectionStringAvailableEvent.java ===== +// ConnectionStringAvailableEvent.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent. */ +public class ConnectionStringAvailableEvent extends HandleWrapperBase { + ConnectionStringAvailableEvent(Handle handle, AspireClient client) { + super(handle, client); + } + + /** Gets the Resource property */ + public IResource resource() { + Map reqArgs = new HashMap<>(); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (IResource) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.resource", reqArgs); + } + + /** Gets the Services property */ + public IServiceProvider services() { + Map reqArgs = new HashMap<>(); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (IServiceProvider) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.services", reqArgs); + } + +} + +// ===== ConnectionStringResource.java ===== +// ConnectionStringResource.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ConnectionStringResource. */ +public class ConnectionStringResource extends ResourceBuilderBase { + ConnectionStringResource(Handle handle, AspireClient client) { + super(handle, client); + } + + /** Configures a resource to use a container registry */ + public ConnectionStringResource withContainerRegistry(IResource registry) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("registry", AspireClient.serializeValue(registry)); + getClient().invokeCapability("Aspire.Hosting/withContainerRegistry", reqArgs); + return this; + } + + public ConnectionStringResource withContainerRegistry(ResourceBuilderBase registry) { + return withContainerRegistry(new IResource(registry.getHandle(), registry.getClient())); + } + + /** Sets the base image for a Dockerfile build */ + public ConnectionStringResource withDockerfileBaseImage(WithDockerfileBaseImageOptions options) { + var buildImage = options == null ? null : options.getBuildImage(); + var runtimeImage = options == null ? null : options.getRuntimeImage(); + return withDockerfileBaseImageImpl(buildImage, runtimeImage); + } + + public ConnectionStringResource withDockerfileBaseImage() { + return withDockerfileBaseImage(null); + } + + /** Sets the base image for a Dockerfile build */ + private ConnectionStringResource withDockerfileBaseImageImpl(String buildImage, String runtimeImage) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + if (buildImage != null) { + reqArgs.put("buildImage", AspireClient.serializeValue(buildImage)); + } + if (runtimeImage != null) { + reqArgs.put("runtimeImage", AspireClient.serializeValue(runtimeImage)); + } + getClient().invokeCapability("Aspire.Hosting/withDockerfileBaseImage", reqArgs); + return this; + } + + public ConnectionStringResource withRequiredCommand(String command) { + return withRequiredCommand(command, null); + } + + /** Adds a required command dependency */ + public ConnectionStringResource withRequiredCommand(String command, String helpLink) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("command", AspireClient.serializeValue(command)); + if (helpLink != null) { + reqArgs.put("helpLink", AspireClient.serializeValue(helpLink)); + } + getClient().invokeCapability("Aspire.Hosting/withRequiredCommand", reqArgs); + return this; + } + + /** Adds a connection property with a reference expression */ + public ConnectionStringResource withConnectionProperty(String name, ReferenceExpression value) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("value", AspireClient.serializeValue(value)); + getClient().invokeCapability("Aspire.Hosting/withConnectionProperty", reqArgs); + return this; + } + + /** Adds a connection property with a string value */ + public ConnectionStringResource withConnectionPropertyValue(String name, String value) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("value", AspireClient.serializeValue(value)); + getClient().invokeCapability("Aspire.Hosting/withConnectionPropertyValue", reqArgs); + return this; + } + + /** Customizes displayed URLs via callback */ + public ConnectionStringResource withUrlsCallback(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var obj = (ResourceUrlsCallbackContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withUrlsCallback", reqArgs); + return this; + } + + /** Customizes displayed URLs via async callback */ + public ConnectionStringResource withUrlsCallbackAsync(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceUrlsCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withUrlsCallbackAsync", reqArgs); + return this; + } + + public ConnectionStringResource withUrl(String url) { + return withUrl(url, null); + } + + /** Adds or modifies displayed URLs */ + public ConnectionStringResource withUrl(String url, String displayText) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("url", AspireClient.serializeValue(url)); + if (displayText != null) { + reqArgs.put("displayText", AspireClient.serializeValue(displayText)); + } + getClient().invokeCapability("Aspire.Hosting/withUrl", reqArgs); + return this; + } + + public ConnectionStringResource withUrlExpression(ReferenceExpression url) { + return withUrlExpression(url, null); + } + + /** Adds a URL using a reference expression */ + public ConnectionStringResource withUrlExpression(ReferenceExpression url, String displayText) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("url", AspireClient.serializeValue(url)); + if (displayText != null) { + reqArgs.put("displayText", AspireClient.serializeValue(displayText)); + } + getClient().invokeCapability("Aspire.Hosting/withUrlExpression", reqArgs); + return this; + } + + /** Customizes the URL for a specific endpoint via callback */ + public ConnectionStringResource withUrlForEndpoint(String endpointName, AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + var callbackId = getClient().registerCallback(args -> { + var obj = (ResourceUrlAnnotation) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withUrlForEndpoint", reqArgs); + return this; + } + + /** Excludes the resource from the deployment manifest */ + public ConnectionStringResource excludeFromManifest() { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + getClient().invokeCapability("Aspire.Hosting/excludeFromManifest", reqArgs); + return this; + } + + /** Waits for another resource to be ready */ + public ConnectionStringResource waitFor(IResource dependency) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + getClient().invokeCapability("Aspire.Hosting/waitFor", reqArgs); + return this; + } + + public ConnectionStringResource waitFor(ResourceBuilderBase dependency) { + return waitFor(new IResource(dependency.getHandle(), dependency.getClient())); + } + + /** Waits for another resource with specific behavior */ + public ConnectionStringResource waitForWithBehavior(IResource dependency, WaitBehavior waitBehavior) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + reqArgs.put("waitBehavior", AspireClient.serializeValue(waitBehavior)); + getClient().invokeCapability("Aspire.Hosting/waitForWithBehavior", reqArgs); + return this; + } + + public ConnectionStringResource waitForWithBehavior(ResourceBuilderBase dependency, WaitBehavior waitBehavior) { + return waitForWithBehavior(new IResource(dependency.getHandle(), dependency.getClient()), waitBehavior); + } + + /** Waits for another resource to start */ + public ConnectionStringResource waitForStart(IResource dependency) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + getClient().invokeCapability("Aspire.Hosting/waitForStart", reqArgs); + return this; + } + + public ConnectionStringResource waitForStart(ResourceBuilderBase dependency) { + return waitForStart(new IResource(dependency.getHandle(), dependency.getClient())); + } + + /** Waits for another resource to start with specific behavior */ + public ConnectionStringResource waitForStartWithBehavior(IResource dependency, WaitBehavior waitBehavior) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + reqArgs.put("waitBehavior", AspireClient.serializeValue(waitBehavior)); + getClient().invokeCapability("Aspire.Hosting/waitForStartWithBehavior", reqArgs); + return this; + } + + public ConnectionStringResource waitForStartWithBehavior(ResourceBuilderBase dependency, WaitBehavior waitBehavior) { + return waitForStartWithBehavior(new IResource(dependency.getHandle(), dependency.getClient()), waitBehavior); + } + + /** Prevents resource from starting automatically */ + public ConnectionStringResource withExplicitStart() { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + getClient().invokeCapability("Aspire.Hosting/withExplicitStart", reqArgs); + return this; + } + + public ConnectionStringResource waitForCompletion(IResource dependency) { + return waitForCompletion(dependency, null); + } + + public ConnectionStringResource waitForCompletion(ResourceBuilderBase dependency) { + return waitForCompletion(new IResource(dependency.getHandle(), dependency.getClient())); + } + + /** Waits for resource completion */ + public ConnectionStringResource waitForCompletion(IResource dependency, Double exitCode) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + if (exitCode != null) { + reqArgs.put("exitCode", AspireClient.serializeValue(exitCode)); + } + getClient().invokeCapability("Aspire.Hosting/waitForCompletion", reqArgs); + return this; + } + + public ConnectionStringResource waitForCompletion(ResourceBuilderBase dependency, Double exitCode) { + return waitForCompletion(new IResource(dependency.getHandle(), dependency.getClient()), exitCode); + } + + /** Adds a health check by key */ + public ConnectionStringResource withHealthCheck(String key) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("key", AspireClient.serializeValue(key)); + getClient().invokeCapability("Aspire.Hosting/withHealthCheck", reqArgs); + return this; + } + + public ConnectionStringResource withCommand(String name, String displayName, AspireFunc1 executeCommand) { + return withCommand(name, displayName, executeCommand, null); + } + + /** Adds a resource command */ + public ConnectionStringResource withCommand(String name, String displayName, AspireFunc1 executeCommand, CommandOptions commandOptions) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("displayName", AspireClient.serializeValue(displayName)); + var executeCommandId = getClient().registerCallback(args -> { + var arg = (ExecuteCommandContext) args[0]; + return AspireClient.awaitValue(executeCommand.invoke(arg)); + }); + if (executeCommandId != null) { + reqArgs.put("executeCommand", executeCommandId); + } + if (commandOptions != null) { + reqArgs.put("commandOptions", AspireClient.serializeValue(commandOptions)); + } + getClient().invokeCapability("Aspire.Hosting/withCommand", reqArgs); + return this; + } + + /** Sets the parent relationship */ + public ConnectionStringResource withParentRelationship(IResource parent) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("parent", AspireClient.serializeValue(parent)); + getClient().invokeCapability("Aspire.Hosting/withParentRelationship", reqArgs); + return this; + } + + public ConnectionStringResource withParentRelationship(ResourceBuilderBase parent) { + return withParentRelationship(new IResource(parent.getHandle(), parent.getClient())); + } + + /** Sets a child relationship */ + public ConnectionStringResource withChildRelationship(IResource child) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("child", AspireClient.serializeValue(child)); + getClient().invokeCapability("Aspire.Hosting/withChildRelationship", reqArgs); + return this; + } + + public ConnectionStringResource withChildRelationship(ResourceBuilderBase child) { + return withChildRelationship(new IResource(child.getHandle(), child.getClient())); + } + + public ConnectionStringResource withIconName(String iconName) { + return withIconName(iconName, null); + } + + /** Sets the icon for the resource */ + public ConnectionStringResource withIconName(String iconName, IconVariant iconVariant) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("iconName", AspireClient.serializeValue(iconName)); + if (iconVariant != null) { + reqArgs.put("iconVariant", AspireClient.serializeValue(iconVariant)); + } + getClient().invokeCapability("Aspire.Hosting/withIconName", reqArgs); + return this; + } + + /** Excludes the resource from MCP server exposure */ + public ConnectionStringResource excludeFromMcp() { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + getClient().invokeCapability("Aspire.Hosting/excludeFromMcp", reqArgs); + return this; + } + + /** Adds a pipeline step to the resource */ + public ConnectionStringResource withPipelineStepFactory(String stepName, AspireAction1 callback, WithPipelineStepFactoryOptions options) { + var dependsOn = options == null ? null : options.getDependsOn(); + var requiredBy = options == null ? null : options.getRequiredBy(); + var tags = options == null ? null : options.getTags(); + var description = options == null ? null : options.getDescription(); + return withPipelineStepFactoryImpl(stepName, callback, dependsOn, requiredBy, tags, description); + } + + public ConnectionStringResource withPipelineStepFactory(String stepName, AspireAction1 callback) { + return withPipelineStepFactory(stepName, callback, null); + } + + /** Adds a pipeline step to the resource */ + private ConnectionStringResource withPipelineStepFactoryImpl(String stepName, AspireAction1 callback, String[] dependsOn, String[] requiredBy, String[] tags, String description) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("stepName", AspireClient.serializeValue(stepName)); + var callbackId = getClient().registerCallback(args -> { + var arg = (PipelineStepContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + if (dependsOn != null) { + reqArgs.put("dependsOn", AspireClient.serializeValue(dependsOn)); + } + if (requiredBy != null) { + reqArgs.put("requiredBy", AspireClient.serializeValue(requiredBy)); + } + if (tags != null) { + reqArgs.put("tags", AspireClient.serializeValue(tags)); + } + if (description != null) { + reqArgs.put("description", AspireClient.serializeValue(description)); + } + getClient().invokeCapability("Aspire.Hosting/withPipelineStepFactory", reqArgs); + return this; + } + + /** Configures pipeline step dependencies via an async callback */ + public ConnectionStringResource withPipelineConfigurationAsync(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (PipelineConfigurationContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withPipelineConfigurationAsync", reqArgs); + return this; + } + + /** Configures pipeline step dependencies via a callback */ + public ConnectionStringResource withPipelineConfiguration(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var obj = (PipelineConfigurationContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withPipelineConfiguration", reqArgs); + return this; + } + + /** Gets the resource name */ + public String getResourceName() { + Map reqArgs = new HashMap<>(); + reqArgs.put("resource", AspireClient.serializeValue(getHandle())); + return (String) getClient().invokeCapability("Aspire.Hosting/getResourceName", reqArgs); + } + + /** Subscribes to the BeforeResourceStarted event */ + public ConnectionStringResource onBeforeResourceStarted(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (BeforeResourceStartedEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onBeforeResourceStarted", reqArgs); + return this; + } + + /** Subscribes to the ResourceStopped event */ + public ConnectionStringResource onResourceStopped(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceStoppedEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onResourceStopped", reqArgs); + return this; + } + + /** Subscribes to the ConnectionStringAvailable event */ + public ConnectionStringResource onConnectionStringAvailable(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (ConnectionStringAvailableEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onConnectionStringAvailable", reqArgs); + return this; + } + + /** Subscribes to the InitializeResource event */ + public ConnectionStringResource onInitializeResource(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (InitializeResourceEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onInitializeResource", reqArgs); + return this; + } + + /** Subscribes to the ResourceReady event */ + public ConnectionStringResource onResourceReady(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceReadyEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onResourceReady", reqArgs); + return this; + } + + /** Adds an optional string parameter */ + public ConnectionStringResource withOptionalString(WithOptionalStringOptions options) { + var value = options == null ? null : options.getValue(); + var enabled = options == null ? null : options.getEnabled(); + return withOptionalStringImpl(value, enabled); + } + + public ConnectionStringResource withOptionalString() { + return withOptionalString(null); + } + + /** Adds an optional string parameter */ + private ConnectionStringResource withOptionalStringImpl(String value, Boolean enabled) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + if (value != null) { + reqArgs.put("value", AspireClient.serializeValue(value)); + } + if (enabled != null) { + reqArgs.put("enabled", AspireClient.serializeValue(enabled)); + } + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalString", reqArgs); + return this; + } + + /** Configures the resource with a DTO */ + public ConnectionStringResource withConfig(TestConfigDto config) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("config", AspireClient.serializeValue(config)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConfig", reqArgs); + return this; + } + + /** Sets the connection string using a reference expression */ + public ConnectionStringResource withConnectionString(ReferenceExpression connectionString) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("connectionString", AspireClient.serializeValue(connectionString)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConnectionString", reqArgs); + return this; + } + + /** Sets the created timestamp */ + public ConnectionStringResource withCreatedAt(String createdAt) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("createdAt", AspireClient.serializeValue(createdAt)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCreatedAt", reqArgs); + return this; + } + + /** Sets the modified timestamp */ + public ConnectionStringResource withModifiedAt(String modifiedAt) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("modifiedAt", AspireClient.serializeValue(modifiedAt)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withModifiedAt", reqArgs); + return this; + } + + /** Sets the correlation ID */ + public ConnectionStringResource withCorrelationId(String correlationId) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("correlationId", AspireClient.serializeValue(correlationId)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCorrelationId", reqArgs); + return this; + } + + public ConnectionStringResource withOptionalCallback() { + return withOptionalCallback(null); + } + + /** Configures with optional callback */ + public ConnectionStringResource withOptionalCallback(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = callback == null ? null : getClient().registerCallback(args -> { + var arg = (TestCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalCallback", reqArgs); + return this; + } + + /** Sets the resource status */ + public ConnectionStringResource withStatus(TestResourceStatus status) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("status", AspireClient.serializeValue(status)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withStatus", reqArgs); + return this; + } + + /** Configures with nested DTO */ + public ConnectionStringResource withNestedConfig(TestNestedDto config) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("config", AspireClient.serializeValue(config)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withNestedConfig", reqArgs); + return this; + } + + /** Adds validation callback */ + public ConnectionStringResource withValidator(AspireFunc1 validator) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var validatorId = getClient().registerCallback(args -> { + var arg = (TestResourceContext) args[0]; + return AspireClient.awaitValue(validator.invoke(arg)); + }); + if (validatorId != null) { + reqArgs.put("validator", validatorId); + } + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withValidator", reqArgs); + return this; + } + + /** Waits for another resource (test version) */ + public ConnectionStringResource testWaitFor(IResource dependency) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWaitFor", reqArgs); + return this; + } + + public ConnectionStringResource testWaitFor(ResourceBuilderBase dependency) { + return testWaitFor(new IResource(dependency.getHandle(), dependency.getClient())); + } + + /** Sets connection string using direct interface target */ + public ConnectionStringResource withConnectionStringDirect(String connectionString) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("connectionString", AspireClient.serializeValue(connectionString)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConnectionStringDirect", reqArgs); + return this; + } + + /** Adds a dependency on another resource */ + public ConnectionStringResource withDependency(IResourceWithConnectionString dependency) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDependency", reqArgs); + return this; + } + + public ConnectionStringResource withDependency(ResourceBuilderBase dependency) { + return withDependency(new IResourceWithConnectionString(dependency.getHandle(), dependency.getClient())); + } + + /** Sets the endpoints */ + public ConnectionStringResource withEndpoints(String[] endpoints) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("endpoints", AspireClient.serializeValue(endpoints)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEndpoints", reqArgs); + return this; + } + + /** Performs a cancellable operation */ + public ConnectionStringResource withCancellableOperation(AspireAction1 operation) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var operationId = getClient().registerCallback(args -> { + var arg = CancellationToken.fromValue(args[0]); + operation.invoke(arg); + return null; + }); + if (operationId != null) { + reqArgs.put("operation", operationId); + } + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCancellableOperation", reqArgs); + return this; + } + +} + +// ===== ContainerLifetime.java ===== +// ContainerLifetime.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** ContainerLifetime enum. */ +public enum ContainerLifetime implements WireValueEnum { + SESSION("Session"), + PERSISTENT("Persistent"); private final String value; - UrlDisplayLocation(String value) { - this.value = value; + ContainerLifetime(String value) { + this.value = value; + } + + public String getValue() { return value; } + + public static ContainerLifetime fromValue(String value) { + for (ContainerLifetime e : values()) { + if (e.value.equals(value)) return e; + } + throw new IllegalArgumentException("Unknown value: " + value); + } +} + +// ===== ContainerRegistryResource.java ===== +// ContainerRegistryResource.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource. */ +public class ContainerRegistryResource extends ResourceBuilderBase { + ContainerRegistryResource(Handle handle, AspireClient client) { + super(handle, client); + } + + /** Configures a resource to use a container registry */ + public ContainerRegistryResource withContainerRegistry(IResource registry) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("registry", AspireClient.serializeValue(registry)); + getClient().invokeCapability("Aspire.Hosting/withContainerRegistry", reqArgs); + return this; + } + + public ContainerRegistryResource withContainerRegistry(ResourceBuilderBase registry) { + return withContainerRegistry(new IResource(registry.getHandle(), registry.getClient())); + } + + /** Sets the base image for a Dockerfile build */ + public ContainerRegistryResource withDockerfileBaseImage(WithDockerfileBaseImageOptions options) { + var buildImage = options == null ? null : options.getBuildImage(); + var runtimeImage = options == null ? null : options.getRuntimeImage(); + return withDockerfileBaseImageImpl(buildImage, runtimeImage); + } + + public ContainerRegistryResource withDockerfileBaseImage() { + return withDockerfileBaseImage(null); + } + + /** Sets the base image for a Dockerfile build */ + private ContainerRegistryResource withDockerfileBaseImageImpl(String buildImage, String runtimeImage) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + if (buildImage != null) { + reqArgs.put("buildImage", AspireClient.serializeValue(buildImage)); + } + if (runtimeImage != null) { + reqArgs.put("runtimeImage", AspireClient.serializeValue(runtimeImage)); + } + getClient().invokeCapability("Aspire.Hosting/withDockerfileBaseImage", reqArgs); + return this; + } + + public ContainerRegistryResource withRequiredCommand(String command) { + return withRequiredCommand(command, null); + } + + /** Adds a required command dependency */ + public ContainerRegistryResource withRequiredCommand(String command, String helpLink) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("command", AspireClient.serializeValue(command)); + if (helpLink != null) { + reqArgs.put("helpLink", AspireClient.serializeValue(helpLink)); + } + getClient().invokeCapability("Aspire.Hosting/withRequiredCommand", reqArgs); + return this; + } + + /** Customizes displayed URLs via callback */ + public ContainerRegistryResource withUrlsCallback(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var obj = (ResourceUrlsCallbackContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withUrlsCallback", reqArgs); + return this; + } + + /** Customizes displayed URLs via async callback */ + public ContainerRegistryResource withUrlsCallbackAsync(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceUrlsCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withUrlsCallbackAsync", reqArgs); + return this; + } + + public ContainerRegistryResource withUrl(String url) { + return withUrl(url, null); + } + + /** Adds or modifies displayed URLs */ + public ContainerRegistryResource withUrl(String url, String displayText) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("url", AspireClient.serializeValue(url)); + if (displayText != null) { + reqArgs.put("displayText", AspireClient.serializeValue(displayText)); + } + getClient().invokeCapability("Aspire.Hosting/withUrl", reqArgs); + return this; + } + + public ContainerRegistryResource withUrlExpression(ReferenceExpression url) { + return withUrlExpression(url, null); + } + + /** Adds a URL using a reference expression */ + public ContainerRegistryResource withUrlExpression(ReferenceExpression url, String displayText) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("url", AspireClient.serializeValue(url)); + if (displayText != null) { + reqArgs.put("displayText", AspireClient.serializeValue(displayText)); + } + getClient().invokeCapability("Aspire.Hosting/withUrlExpression", reqArgs); + return this; + } + + /** Customizes the URL for a specific endpoint via callback */ + public ContainerRegistryResource withUrlForEndpoint(String endpointName, AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + var callbackId = getClient().registerCallback(args -> { + var obj = (ResourceUrlAnnotation) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withUrlForEndpoint", reqArgs); + return this; + } + + /** Excludes the resource from the deployment manifest */ + public ContainerRegistryResource excludeFromManifest() { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + getClient().invokeCapability("Aspire.Hosting/excludeFromManifest", reqArgs); + return this; + } + + /** Prevents resource from starting automatically */ + public ContainerRegistryResource withExplicitStart() { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + getClient().invokeCapability("Aspire.Hosting/withExplicitStart", reqArgs); + return this; + } + + /** Adds a health check by key */ + public ContainerRegistryResource withHealthCheck(String key) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("key", AspireClient.serializeValue(key)); + getClient().invokeCapability("Aspire.Hosting/withHealthCheck", reqArgs); + return this; + } + + public ContainerRegistryResource withCommand(String name, String displayName, AspireFunc1 executeCommand) { + return withCommand(name, displayName, executeCommand, null); + } + + /** Adds a resource command */ + public ContainerRegistryResource withCommand(String name, String displayName, AspireFunc1 executeCommand, CommandOptions commandOptions) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("displayName", AspireClient.serializeValue(displayName)); + var executeCommandId = getClient().registerCallback(args -> { + var arg = (ExecuteCommandContext) args[0]; + return AspireClient.awaitValue(executeCommand.invoke(arg)); + }); + if (executeCommandId != null) { + reqArgs.put("executeCommand", executeCommandId); + } + if (commandOptions != null) { + reqArgs.put("commandOptions", AspireClient.serializeValue(commandOptions)); + } + getClient().invokeCapability("Aspire.Hosting/withCommand", reqArgs); + return this; + } + + /** Sets the parent relationship */ + public ContainerRegistryResource withParentRelationship(IResource parent) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("parent", AspireClient.serializeValue(parent)); + getClient().invokeCapability("Aspire.Hosting/withParentRelationship", reqArgs); + return this; + } + + public ContainerRegistryResource withParentRelationship(ResourceBuilderBase parent) { + return withParentRelationship(new IResource(parent.getHandle(), parent.getClient())); + } + + /** Sets a child relationship */ + public ContainerRegistryResource withChildRelationship(IResource child) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("child", AspireClient.serializeValue(child)); + getClient().invokeCapability("Aspire.Hosting/withChildRelationship", reqArgs); + return this; + } + + public ContainerRegistryResource withChildRelationship(ResourceBuilderBase child) { + return withChildRelationship(new IResource(child.getHandle(), child.getClient())); + } + + public ContainerRegistryResource withIconName(String iconName) { + return withIconName(iconName, null); + } + + /** Sets the icon for the resource */ + public ContainerRegistryResource withIconName(String iconName, IconVariant iconVariant) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("iconName", AspireClient.serializeValue(iconName)); + if (iconVariant != null) { + reqArgs.put("iconVariant", AspireClient.serializeValue(iconVariant)); + } + getClient().invokeCapability("Aspire.Hosting/withIconName", reqArgs); + return this; + } + + /** Excludes the resource from MCP server exposure */ + public ContainerRegistryResource excludeFromMcp() { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + getClient().invokeCapability("Aspire.Hosting/excludeFromMcp", reqArgs); + return this; + } + + /** Adds a pipeline step to the resource */ + public ContainerRegistryResource withPipelineStepFactory(String stepName, AspireAction1 callback, WithPipelineStepFactoryOptions options) { + var dependsOn = options == null ? null : options.getDependsOn(); + var requiredBy = options == null ? null : options.getRequiredBy(); + var tags = options == null ? null : options.getTags(); + var description = options == null ? null : options.getDescription(); + return withPipelineStepFactoryImpl(stepName, callback, dependsOn, requiredBy, tags, description); + } + + public ContainerRegistryResource withPipelineStepFactory(String stepName, AspireAction1 callback) { + return withPipelineStepFactory(stepName, callback, null); + } + + /** Adds a pipeline step to the resource */ + private ContainerRegistryResource withPipelineStepFactoryImpl(String stepName, AspireAction1 callback, String[] dependsOn, String[] requiredBy, String[] tags, String description) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("stepName", AspireClient.serializeValue(stepName)); + var callbackId = getClient().registerCallback(args -> { + var arg = (PipelineStepContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + if (dependsOn != null) { + reqArgs.put("dependsOn", AspireClient.serializeValue(dependsOn)); + } + if (requiredBy != null) { + reqArgs.put("requiredBy", AspireClient.serializeValue(requiredBy)); + } + if (tags != null) { + reqArgs.put("tags", AspireClient.serializeValue(tags)); + } + if (description != null) { + reqArgs.put("description", AspireClient.serializeValue(description)); + } + getClient().invokeCapability("Aspire.Hosting/withPipelineStepFactory", reqArgs); + return this; + } + + /** Configures pipeline step dependencies via an async callback */ + public ContainerRegistryResource withPipelineConfigurationAsync(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (PipelineConfigurationContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withPipelineConfigurationAsync", reqArgs); + return this; + } + + /** Configures pipeline step dependencies via a callback */ + public ContainerRegistryResource withPipelineConfiguration(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var obj = (PipelineConfigurationContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withPipelineConfiguration", reqArgs); + return this; + } + + /** Gets the resource name */ + public String getResourceName() { + Map reqArgs = new HashMap<>(); + reqArgs.put("resource", AspireClient.serializeValue(getHandle())); + return (String) getClient().invokeCapability("Aspire.Hosting/getResourceName", reqArgs); + } + + /** Subscribes to the BeforeResourceStarted event */ + public ContainerRegistryResource onBeforeResourceStarted(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (BeforeResourceStartedEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onBeforeResourceStarted", reqArgs); + return this; + } + + /** Subscribes to the ResourceStopped event */ + public ContainerRegistryResource onResourceStopped(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceStoppedEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onResourceStopped", reqArgs); + return this; + } + + /** Subscribes to the InitializeResource event */ + public ContainerRegistryResource onInitializeResource(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (InitializeResourceEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onInitializeResource", reqArgs); + return this; + } + + /** Subscribes to the ResourceReady event */ + public ContainerRegistryResource onResourceReady(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceReadyEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onResourceReady", reqArgs); + return this; + } + + /** Adds an optional string parameter */ + public ContainerRegistryResource withOptionalString(WithOptionalStringOptions options) { + var value = options == null ? null : options.getValue(); + var enabled = options == null ? null : options.getEnabled(); + return withOptionalStringImpl(value, enabled); + } + + public ContainerRegistryResource withOptionalString() { + return withOptionalString(null); + } + + /** Adds an optional string parameter */ + private ContainerRegistryResource withOptionalStringImpl(String value, Boolean enabled) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + if (value != null) { + reqArgs.put("value", AspireClient.serializeValue(value)); + } + if (enabled != null) { + reqArgs.put("enabled", AspireClient.serializeValue(enabled)); + } + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalString", reqArgs); + return this; + } + + /** Configures the resource with a DTO */ + public ContainerRegistryResource withConfig(TestConfigDto config) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("config", AspireClient.serializeValue(config)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConfig", reqArgs); + return this; + } + + /** Sets the created timestamp */ + public ContainerRegistryResource withCreatedAt(String createdAt) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("createdAt", AspireClient.serializeValue(createdAt)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCreatedAt", reqArgs); + return this; + } + + /** Sets the modified timestamp */ + public ContainerRegistryResource withModifiedAt(String modifiedAt) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("modifiedAt", AspireClient.serializeValue(modifiedAt)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withModifiedAt", reqArgs); + return this; + } + + /** Sets the correlation ID */ + public ContainerRegistryResource withCorrelationId(String correlationId) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("correlationId", AspireClient.serializeValue(correlationId)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCorrelationId", reqArgs); + return this; + } + + public ContainerRegistryResource withOptionalCallback() { + return withOptionalCallback(null); + } + + /** Configures with optional callback */ + public ContainerRegistryResource withOptionalCallback(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = callback == null ? null : getClient().registerCallback(args -> { + var arg = (TestCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalCallback", reqArgs); + return this; + } + + /** Sets the resource status */ + public ContainerRegistryResource withStatus(TestResourceStatus status) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("status", AspireClient.serializeValue(status)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withStatus", reqArgs); + return this; + } + + /** Configures with nested DTO */ + public ContainerRegistryResource withNestedConfig(TestNestedDto config) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("config", AspireClient.serializeValue(config)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withNestedConfig", reqArgs); + return this; + } + + /** Adds validation callback */ + public ContainerRegistryResource withValidator(AspireFunc1 validator) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var validatorId = getClient().registerCallback(args -> { + var arg = (TestResourceContext) args[0]; + return AspireClient.awaitValue(validator.invoke(arg)); + }); + if (validatorId != null) { + reqArgs.put("validator", validatorId); + } + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withValidator", reqArgs); + return this; + } + + /** Waits for another resource (test version) */ + public ContainerRegistryResource testWaitFor(IResource dependency) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWaitFor", reqArgs); + return this; + } + + public ContainerRegistryResource testWaitFor(ResourceBuilderBase dependency) { + return testWaitFor(new IResource(dependency.getHandle(), dependency.getClient())); + } + + /** Adds a dependency on another resource */ + public ContainerRegistryResource withDependency(IResourceWithConnectionString dependency) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDependency", reqArgs); + return this; + } + + public ContainerRegistryResource withDependency(ResourceBuilderBase dependency) { + return withDependency(new IResourceWithConnectionString(dependency.getHandle(), dependency.getClient())); + } + + /** Sets the endpoints */ + public ContainerRegistryResource withEndpoints(String[] endpoints) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("endpoints", AspireClient.serializeValue(endpoints)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEndpoints", reqArgs); + return this; + } + + /** Performs a cancellable operation */ + public ContainerRegistryResource withCancellableOperation(AspireAction1 operation) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var operationId = getClient().registerCallback(args -> { + var arg = CancellationToken.fromValue(args[0]); + operation.invoke(arg); + return null; + }); + if (operationId != null) { + reqArgs.put("operation", operationId); + } + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCancellableOperation", reqArgs); + return this; + } + +} + +// ===== ContainerResource.java ===== +// ContainerResource.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource. */ +public class ContainerResource extends ResourceBuilderBase { + ContainerResource(Handle handle, AspireClient client) { + super(handle, client); + } + + /** Configures a resource to use a container registry */ + public ContainerResource withContainerRegistry(IResource registry) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("registry", AspireClient.serializeValue(registry)); + getClient().invokeCapability("Aspire.Hosting/withContainerRegistry", reqArgs); + return this; + } + + public ContainerResource withContainerRegistry(ResourceBuilderBase registry) { + return withContainerRegistry(new IResource(registry.getHandle(), registry.getClient())); + } + + public ContainerResource withBindMount(String source, String target) { + return withBindMount(source, target, null); + } + + /** Adds a bind mount */ + public ContainerResource withBindMount(String source, String target, Boolean isReadOnly) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("source", AspireClient.serializeValue(source)); + reqArgs.put("target", AspireClient.serializeValue(target)); + if (isReadOnly != null) { + reqArgs.put("isReadOnly", AspireClient.serializeValue(isReadOnly)); + } + getClient().invokeCapability("Aspire.Hosting/withBindMount", reqArgs); + return this; + } + + /** Sets the container entrypoint */ + public ContainerResource withEntrypoint(String entrypoint) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("entrypoint", AspireClient.serializeValue(entrypoint)); + getClient().invokeCapability("Aspire.Hosting/withEntrypoint", reqArgs); + return this; + } + + /** Sets the container image tag */ + public ContainerResource withImageTag(String tag) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("tag", AspireClient.serializeValue(tag)); + getClient().invokeCapability("Aspire.Hosting/withImageTag", reqArgs); + return this; + } + + /** Sets the container image registry */ + public ContainerResource withImageRegistry(String registry) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("registry", AspireClient.serializeValue(registry)); + getClient().invokeCapability("Aspire.Hosting/withImageRegistry", reqArgs); + return this; + } + + public ContainerResource withImage(String image) { + return withImage(image, null); + } + + /** Sets the container image */ + public ContainerResource withImage(String image, String tag) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("image", AspireClient.serializeValue(image)); + if (tag != null) { + reqArgs.put("tag", AspireClient.serializeValue(tag)); + } + getClient().invokeCapability("Aspire.Hosting/withImage", reqArgs); + return this; + } + + /** Sets the image SHA256 digest */ + public ContainerResource withImageSHA256(String sha256) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("sha256", AspireClient.serializeValue(sha256)); + getClient().invokeCapability("Aspire.Hosting/withImageSHA256", reqArgs); + return this; + } + + /** Adds runtime arguments for the container */ + public ContainerResource withContainerRuntimeArgs(String[] args) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("args", AspireClient.serializeValue(args)); + getClient().invokeCapability("Aspire.Hosting/withContainerRuntimeArgs", reqArgs); + return this; + } + + /** Sets the lifetime behavior of the container resource */ + public ContainerResource withLifetime(ContainerLifetime lifetime) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("lifetime", AspireClient.serializeValue(lifetime)); + getClient().invokeCapability("Aspire.Hosting/withLifetime", reqArgs); + return this; + } + + /** Sets the container image pull policy */ + public ContainerResource withImagePullPolicy(ImagePullPolicy pullPolicy) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("pullPolicy", AspireClient.serializeValue(pullPolicy)); + getClient().invokeCapability("Aspire.Hosting/withImagePullPolicy", reqArgs); + return this; + } + + /** Configures the resource to be published as a container */ + public ContainerResource publishAsContainer() { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + getClient().invokeCapability("Aspire.Hosting/publishAsContainer", reqArgs); + return this; + } + + /** Configures the resource to use a Dockerfile */ + public ContainerResource withDockerfile(String contextPath, WithDockerfileOptions options) { + var dockerfilePath = options == null ? null : options.getDockerfilePath(); + var stage = options == null ? null : options.getStage(); + return withDockerfileImpl(contextPath, dockerfilePath, stage); + } + + public ContainerResource withDockerfile(String contextPath) { + return withDockerfile(contextPath, null); + } + + /** Configures the resource to use a Dockerfile */ + private ContainerResource withDockerfileImpl(String contextPath, String dockerfilePath, String stage) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("contextPath", AspireClient.serializeValue(contextPath)); + if (dockerfilePath != null) { + reqArgs.put("dockerfilePath", AspireClient.serializeValue(dockerfilePath)); + } + if (stage != null) { + reqArgs.put("stage", AspireClient.serializeValue(stage)); + } + getClient().invokeCapability("Aspire.Hosting/withDockerfile", reqArgs); + return this; + } + + /** Sets the container name */ + public ContainerResource withContainerName(String name) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("name", AspireClient.serializeValue(name)); + getClient().invokeCapability("Aspire.Hosting/withContainerName", reqArgs); + return this; + } + + /** Adds a build argument from a parameter resource */ + public ContainerResource withBuildArg(String name, ParameterResource value) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("value", AspireClient.serializeValue(value)); + getClient().invokeCapability("Aspire.Hosting/withBuildArg", reqArgs); + return this; + } + + /** Adds a build secret from a parameter resource */ + public ContainerResource withBuildSecret(String name, ParameterResource value) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("value", AspireClient.serializeValue(value)); + getClient().invokeCapability("Aspire.Hosting/withBuildSecret", reqArgs); + return this; + } + + /** Configures endpoint proxy support */ + public ContainerResource withEndpointProxySupport(boolean proxyEnabled) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("proxyEnabled", AspireClient.serializeValue(proxyEnabled)); + getClient().invokeCapability("Aspire.Hosting/withEndpointProxySupport", reqArgs); + return this; + } + + /** Sets the base image for a Dockerfile build */ + public ContainerResource withDockerfileBaseImage(WithDockerfileBaseImageOptions options) { + var buildImage = options == null ? null : options.getBuildImage(); + var runtimeImage = options == null ? null : options.getRuntimeImage(); + return withDockerfileBaseImageImpl(buildImage, runtimeImage); + } + + public ContainerResource withDockerfileBaseImage() { + return withDockerfileBaseImage(null); + } + + /** Sets the base image for a Dockerfile build */ + private ContainerResource withDockerfileBaseImageImpl(String buildImage, String runtimeImage) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + if (buildImage != null) { + reqArgs.put("buildImage", AspireClient.serializeValue(buildImage)); + } + if (runtimeImage != null) { + reqArgs.put("runtimeImage", AspireClient.serializeValue(runtimeImage)); + } + getClient().invokeCapability("Aspire.Hosting/withDockerfileBaseImage", reqArgs); + return this; + } + + /** Adds a network alias for the container */ + public ContainerResource withContainerNetworkAlias(String alias) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("alias", AspireClient.serializeValue(alias)); + getClient().invokeCapability("Aspire.Hosting/withContainerNetworkAlias", reqArgs); + return this; + } + + /** Configures an MCP server endpoint on the resource */ + public ContainerResource withMcpServer(WithMcpServerOptions options) { + var path = options == null ? null : options.getPath(); + var endpointName = options == null ? null : options.getEndpointName(); + return withMcpServerImpl(path, endpointName); + } + + public ContainerResource withMcpServer() { + return withMcpServer(null); + } + + /** Configures an MCP server endpoint on the resource */ + private ContainerResource withMcpServerImpl(String path, String endpointName) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + if (path != null) { + reqArgs.put("path", AspireClient.serializeValue(path)); + } + if (endpointName != null) { + reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + } + getClient().invokeCapability("Aspire.Hosting/withMcpServer", reqArgs); + return this; + } + + /** Configures OTLP telemetry export */ + public ContainerResource withOtlpExporter() { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + getClient().invokeCapability("Aspire.Hosting/withOtlpExporter", reqArgs); + return this; + } + + /** Configures OTLP telemetry export with specific protocol */ + public ContainerResource withOtlpExporterProtocol(OtlpProtocol protocol) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("protocol", AspireClient.serializeValue(protocol)); + getClient().invokeCapability("Aspire.Hosting/withOtlpExporterProtocol", reqArgs); + return this; + } + + /** Publishes the resource as a connection string */ + public ContainerResource publishAsConnectionString() { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + getClient().invokeCapability("Aspire.Hosting/publishAsConnectionString", reqArgs); + return this; + } + + public ContainerResource withRequiredCommand(String command) { + return withRequiredCommand(command, null); + } + + /** Adds a required command dependency */ + public ContainerResource withRequiredCommand(String command, String helpLink) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("command", AspireClient.serializeValue(command)); + if (helpLink != null) { + reqArgs.put("helpLink", AspireClient.serializeValue(helpLink)); + } + getClient().invokeCapability("Aspire.Hosting/withRequiredCommand", reqArgs); + return this; + } + + /** Sets an environment variable */ + public ContainerResource withEnvironment(String name, String value) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("value", AspireClient.serializeValue(value)); + getClient().invokeCapability("Aspire.Hosting/withEnvironment", reqArgs); + return this; + } + + /** Adds an environment variable with a reference expression */ + public ContainerResource withEnvironmentExpression(String name, ReferenceExpression value) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("value", AspireClient.serializeValue(value)); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentExpression", reqArgs); + return this; + } + + /** Sets environment variables via callback */ + public ContainerResource withEnvironmentCallback(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var obj = (EnvironmentCallbackContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withEnvironmentCallback", reqArgs); + return this; + } + + /** Sets environment variables via async callback */ + public ContainerResource withEnvironmentCallbackAsync(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (EnvironmentCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withEnvironmentCallbackAsync", reqArgs); + return this; + } + + /** Sets an environment variable from an endpoint reference */ + public ContainerResource withEnvironmentEndpoint(String name, EndpointReference endpointReference) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("endpointReference", AspireClient.serializeValue(endpointReference)); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentEndpoint", reqArgs); + return this; + } + + /** Sets an environment variable from a parameter resource */ + public ContainerResource withEnvironmentParameter(String name, ParameterResource parameter) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("parameter", AspireClient.serializeValue(parameter)); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentParameter", reqArgs); + return this; + } + + /** Sets an environment variable from a connection string resource */ + public ContainerResource withEnvironmentConnectionString(String envVarName, IResourceWithConnectionString resource) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("envVarName", AspireClient.serializeValue(envVarName)); + reqArgs.put("resource", AspireClient.serializeValue(resource)); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentConnectionString", reqArgs); + return this; + } + + public ContainerResource withEnvironmentConnectionString(String envVarName, ResourceBuilderBase resource) { + return withEnvironmentConnectionString(envVarName, new IResourceWithConnectionString(resource.getHandle(), resource.getClient())); + } + + /** Adds arguments */ + public ContainerResource withArgs(String[] args) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("args", AspireClient.serializeValue(args)); + getClient().invokeCapability("Aspire.Hosting/withArgs", reqArgs); + return this; + } + + /** Sets command-line arguments via callback */ + public ContainerResource withArgsCallback(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var obj = (CommandLineArgsCallbackContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withArgsCallback", reqArgs); + return this; + } + + /** Sets command-line arguments via async callback */ + public ContainerResource withArgsCallbackAsync(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (CommandLineArgsCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withArgsCallbackAsync", reqArgs); + return this; + } + + /** Adds a reference to another resource */ + public ContainerResource withReference(IResource source, WithReferenceOptions options) { + var connectionName = options == null ? null : options.getConnectionName(); + var optional = options == null ? null : options.getOptional(); + var name = options == null ? null : options.getName(); + return withReferenceImpl(source, connectionName, optional, name); + } + + public ContainerResource withReference(ResourceBuilderBase source, WithReferenceOptions options) { + return withReference(new IResource(source.getHandle(), source.getClient()), options); + } + + public ContainerResource withReference(IResource source) { + return withReference(source, null); + } + + public ContainerResource withReference(ResourceBuilderBase source) { + return withReference(new IResource(source.getHandle(), source.getClient())); + } + + /** Adds a reference to another resource */ + private ContainerResource withReferenceImpl(IResource source, String connectionName, Boolean optional, String name) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("source", AspireClient.serializeValue(source)); + if (connectionName != null) { + reqArgs.put("connectionName", AspireClient.serializeValue(connectionName)); + } + if (optional != null) { + reqArgs.put("optional", AspireClient.serializeValue(optional)); + } + if (name != null) { + reqArgs.put("name", AspireClient.serializeValue(name)); + } + getClient().invokeCapability("Aspire.Hosting/withReference", reqArgs); + return this; + } + + /** Adds a reference to a URI */ + public ContainerResource withReferenceUri(String name, String uri) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("uri", AspireClient.serializeValue(uri)); + getClient().invokeCapability("Aspire.Hosting/withReferenceUri", reqArgs); + return this; + } + + /** Adds a reference to an external service */ + public ContainerResource withReferenceExternalService(ExternalServiceResource externalService) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("externalService", AspireClient.serializeValue(externalService)); + getClient().invokeCapability("Aspire.Hosting/withReferenceExternalService", reqArgs); + return this; + } + + /** Adds a reference to an endpoint */ + public ContainerResource withReferenceEndpoint(EndpointReference endpointReference) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("endpointReference", AspireClient.serializeValue(endpointReference)); + getClient().invokeCapability("Aspire.Hosting/withReferenceEndpoint", reqArgs); + return this; + } + + /** Adds a network endpoint */ + public ContainerResource withEndpoint(WithEndpointOptions options) { + var port = options == null ? null : options.getPort(); + var targetPort = options == null ? null : options.getTargetPort(); + var scheme = options == null ? null : options.getScheme(); + var name = options == null ? null : options.getName(); + var env = options == null ? null : options.getEnv(); + var isProxied = options == null ? null : options.isProxied(); + var isExternal = options == null ? null : options.isExternal(); + var protocol = options == null ? null : options.getProtocol(); + return withEndpointImpl(port, targetPort, scheme, name, env, isProxied, isExternal, protocol); + } + + public ContainerResource withEndpoint() { + return withEndpoint(null); + } + + /** Adds a network endpoint */ + private ContainerResource withEndpointImpl(Double port, Double targetPort, String scheme, String name, String env, Boolean isProxied, Boolean isExternal, ProtocolType protocol) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + if (port != null) { + reqArgs.put("port", AspireClient.serializeValue(port)); + } + if (targetPort != null) { + reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); + } + if (scheme != null) { + reqArgs.put("scheme", AspireClient.serializeValue(scheme)); + } + if (name != null) { + reqArgs.put("name", AspireClient.serializeValue(name)); + } + if (env != null) { + reqArgs.put("env", AspireClient.serializeValue(env)); + } + if (isProxied != null) { + reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); + } + if (isExternal != null) { + reqArgs.put("isExternal", AspireClient.serializeValue(isExternal)); + } + if (protocol != null) { + reqArgs.put("protocol", AspireClient.serializeValue(protocol)); + } + getClient().invokeCapability("Aspire.Hosting/withEndpoint", reqArgs); + return this; + } + + /** Adds an HTTP endpoint */ + public ContainerResource withHttpEndpoint(WithHttpEndpointOptions options) { + var port = options == null ? null : options.getPort(); + var targetPort = options == null ? null : options.getTargetPort(); + var name = options == null ? null : options.getName(); + var env = options == null ? null : options.getEnv(); + var isProxied = options == null ? null : options.isProxied(); + return withHttpEndpointImpl(port, targetPort, name, env, isProxied); + } + + public ContainerResource withHttpEndpoint() { + return withHttpEndpoint(null); + } + + /** Adds an HTTP endpoint */ + private ContainerResource withHttpEndpointImpl(Double port, Double targetPort, String name, String env, Boolean isProxied) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + if (port != null) { + reqArgs.put("port", AspireClient.serializeValue(port)); + } + if (targetPort != null) { + reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); + } + if (name != null) { + reqArgs.put("name", AspireClient.serializeValue(name)); + } + if (env != null) { + reqArgs.put("env", AspireClient.serializeValue(env)); + } + if (isProxied != null) { + reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); + } + getClient().invokeCapability("Aspire.Hosting/withHttpEndpoint", reqArgs); + return this; + } + + /** Adds an HTTPS endpoint */ + public ContainerResource withHttpsEndpoint(WithHttpsEndpointOptions options) { + var port = options == null ? null : options.getPort(); + var targetPort = options == null ? null : options.getTargetPort(); + var name = options == null ? null : options.getName(); + var env = options == null ? null : options.getEnv(); + var isProxied = options == null ? null : options.isProxied(); + return withHttpsEndpointImpl(port, targetPort, name, env, isProxied); + } + + public ContainerResource withHttpsEndpoint() { + return withHttpsEndpoint(null); + } + + /** Adds an HTTPS endpoint */ + private ContainerResource withHttpsEndpointImpl(Double port, Double targetPort, String name, String env, Boolean isProxied) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + if (port != null) { + reqArgs.put("port", AspireClient.serializeValue(port)); + } + if (targetPort != null) { + reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); + } + if (name != null) { + reqArgs.put("name", AspireClient.serializeValue(name)); + } + if (env != null) { + reqArgs.put("env", AspireClient.serializeValue(env)); + } + if (isProxied != null) { + reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); + } + getClient().invokeCapability("Aspire.Hosting/withHttpsEndpoint", reqArgs); + return this; + } + + /** Makes HTTP endpoints externally accessible */ + public ContainerResource withExternalHttpEndpoints() { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + getClient().invokeCapability("Aspire.Hosting/withExternalHttpEndpoints", reqArgs); + return this; + } + + /** Gets an endpoint reference */ + public EndpointReference getEndpoint(String name) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("name", AspireClient.serializeValue(name)); + return (EndpointReference) getClient().invokeCapability("Aspire.Hosting/getEndpoint", reqArgs); + } + + /** Configures resource for HTTP/2 */ + public ContainerResource asHttp2Service() { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + getClient().invokeCapability("Aspire.Hosting/asHttp2Service", reqArgs); + return this; + } + + /** Customizes displayed URLs via callback */ + public ContainerResource withUrlsCallback(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var obj = (ResourceUrlsCallbackContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withUrlsCallback", reqArgs); + return this; + } + + /** Customizes displayed URLs via async callback */ + public ContainerResource withUrlsCallbackAsync(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceUrlsCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withUrlsCallbackAsync", reqArgs); + return this; + } + + public ContainerResource withUrl(String url) { + return withUrl(url, null); + } + + /** Adds or modifies displayed URLs */ + public ContainerResource withUrl(String url, String displayText) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("url", AspireClient.serializeValue(url)); + if (displayText != null) { + reqArgs.put("displayText", AspireClient.serializeValue(displayText)); + } + getClient().invokeCapability("Aspire.Hosting/withUrl", reqArgs); + return this; + } + + public ContainerResource withUrlExpression(ReferenceExpression url) { + return withUrlExpression(url, null); + } + + /** Adds a URL using a reference expression */ + public ContainerResource withUrlExpression(ReferenceExpression url, String displayText) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("url", AspireClient.serializeValue(url)); + if (displayText != null) { + reqArgs.put("displayText", AspireClient.serializeValue(displayText)); + } + getClient().invokeCapability("Aspire.Hosting/withUrlExpression", reqArgs); + return this; + } + + /** Customizes the URL for a specific endpoint via callback */ + public ContainerResource withUrlForEndpoint(String endpointName, AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + var callbackId = getClient().registerCallback(args -> { + var obj = (ResourceUrlAnnotation) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withUrlForEndpoint", reqArgs); + return this; + } + + /** Adds a URL for a specific endpoint via factory callback */ + public ContainerResource withUrlForEndpointFactory(String endpointName, AspireFunc1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + var callbackId = getClient().registerCallback(args -> { + var arg = (EndpointReference) args[0]; + return AspireClient.awaitValue(callback.invoke(arg)); + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withUrlForEndpointFactory", reqArgs); + return this; + } + + /** Excludes the resource from the deployment manifest */ + public ContainerResource excludeFromManifest() { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + getClient().invokeCapability("Aspire.Hosting/excludeFromManifest", reqArgs); + return this; + } + + /** Waits for another resource to be ready */ + public ContainerResource waitFor(IResource dependency) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + getClient().invokeCapability("Aspire.Hosting/waitFor", reqArgs); + return this; + } + + public ContainerResource waitFor(ResourceBuilderBase dependency) { + return waitFor(new IResource(dependency.getHandle(), dependency.getClient())); + } + + /** Waits for another resource with specific behavior */ + public ContainerResource waitForWithBehavior(IResource dependency, WaitBehavior waitBehavior) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + reqArgs.put("waitBehavior", AspireClient.serializeValue(waitBehavior)); + getClient().invokeCapability("Aspire.Hosting/waitForWithBehavior", reqArgs); + return this; + } + + public ContainerResource waitForWithBehavior(ResourceBuilderBase dependency, WaitBehavior waitBehavior) { + return waitForWithBehavior(new IResource(dependency.getHandle(), dependency.getClient()), waitBehavior); + } + + /** Waits for another resource to start */ + public ContainerResource waitForStart(IResource dependency) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + getClient().invokeCapability("Aspire.Hosting/waitForStart", reqArgs); + return this; + } + + public ContainerResource waitForStart(ResourceBuilderBase dependency) { + return waitForStart(new IResource(dependency.getHandle(), dependency.getClient())); + } + + /** Waits for another resource to start with specific behavior */ + public ContainerResource waitForStartWithBehavior(IResource dependency, WaitBehavior waitBehavior) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + reqArgs.put("waitBehavior", AspireClient.serializeValue(waitBehavior)); + getClient().invokeCapability("Aspire.Hosting/waitForStartWithBehavior", reqArgs); + return this; + } + + public ContainerResource waitForStartWithBehavior(ResourceBuilderBase dependency, WaitBehavior waitBehavior) { + return waitForStartWithBehavior(new IResource(dependency.getHandle(), dependency.getClient()), waitBehavior); + } + + /** Prevents resource from starting automatically */ + public ContainerResource withExplicitStart() { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + getClient().invokeCapability("Aspire.Hosting/withExplicitStart", reqArgs); + return this; + } + + public ContainerResource waitForCompletion(IResource dependency) { + return waitForCompletion(dependency, null); + } + + public ContainerResource waitForCompletion(ResourceBuilderBase dependency) { + return waitForCompletion(new IResource(dependency.getHandle(), dependency.getClient())); + } + + /** Waits for resource completion */ + public ContainerResource waitForCompletion(IResource dependency, Double exitCode) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + if (exitCode != null) { + reqArgs.put("exitCode", AspireClient.serializeValue(exitCode)); + } + getClient().invokeCapability("Aspire.Hosting/waitForCompletion", reqArgs); + return this; + } + + public ContainerResource waitForCompletion(ResourceBuilderBase dependency, Double exitCode) { + return waitForCompletion(new IResource(dependency.getHandle(), dependency.getClient()), exitCode); + } + + /** Adds a health check by key */ + public ContainerResource withHealthCheck(String key) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("key", AspireClient.serializeValue(key)); + getClient().invokeCapability("Aspire.Hosting/withHealthCheck", reqArgs); + return this; + } + + /** Adds an HTTP health check */ + public ContainerResource withHttpHealthCheck(WithHttpHealthCheckOptions options) { + var path = options == null ? null : options.getPath(); + var statusCode = options == null ? null : options.getStatusCode(); + var endpointName = options == null ? null : options.getEndpointName(); + return withHttpHealthCheckImpl(path, statusCode, endpointName); + } + + public ContainerResource withHttpHealthCheck() { + return withHttpHealthCheck(null); + } + + /** Adds an HTTP health check */ + private ContainerResource withHttpHealthCheckImpl(String path, Double statusCode, String endpointName) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + if (path != null) { + reqArgs.put("path", AspireClient.serializeValue(path)); + } + if (statusCode != null) { + reqArgs.put("statusCode", AspireClient.serializeValue(statusCode)); + } + if (endpointName != null) { + reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + } + getClient().invokeCapability("Aspire.Hosting/withHttpHealthCheck", reqArgs); + return this; + } + + public ContainerResource withCommand(String name, String displayName, AspireFunc1 executeCommand) { + return withCommand(name, displayName, executeCommand, null); + } + + /** Adds a resource command */ + public ContainerResource withCommand(String name, String displayName, AspireFunc1 executeCommand, CommandOptions commandOptions) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("displayName", AspireClient.serializeValue(displayName)); + var executeCommandId = getClient().registerCallback(args -> { + var arg = (ExecuteCommandContext) args[0]; + return AspireClient.awaitValue(executeCommand.invoke(arg)); + }); + if (executeCommandId != null) { + reqArgs.put("executeCommand", executeCommandId); + } + if (commandOptions != null) { + reqArgs.put("commandOptions", AspireClient.serializeValue(commandOptions)); + } + getClient().invokeCapability("Aspire.Hosting/withCommand", reqArgs); + return this; + } + + /** Configures developer certificate trust */ + public ContainerResource withDeveloperCertificateTrust(boolean trust) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("trust", AspireClient.serializeValue(trust)); + getClient().invokeCapability("Aspire.Hosting/withDeveloperCertificateTrust", reqArgs); + return this; + } + + /** Sets the certificate trust scope */ + public ContainerResource withCertificateTrustScope(CertificateTrustScope scope) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("scope", AspireClient.serializeValue(scope)); + getClient().invokeCapability("Aspire.Hosting/withCertificateTrustScope", reqArgs); + return this; + } + + public ContainerResource withHttpsDeveloperCertificate() { + return withHttpsDeveloperCertificate(null); + } + + /** Configures HTTPS with a developer certificate */ + public ContainerResource withHttpsDeveloperCertificate(ParameterResource password) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + if (password != null) { + reqArgs.put("password", AspireClient.serializeValue(password)); + } + getClient().invokeCapability("Aspire.Hosting/withHttpsDeveloperCertificate", reqArgs); + return this; + } + + /** Removes HTTPS certificate configuration */ + public ContainerResource withoutHttpsCertificate() { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + getClient().invokeCapability("Aspire.Hosting/withoutHttpsCertificate", reqArgs); + return this; + } + + /** Sets the parent relationship */ + public ContainerResource withParentRelationship(IResource parent) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("parent", AspireClient.serializeValue(parent)); + getClient().invokeCapability("Aspire.Hosting/withParentRelationship", reqArgs); + return this; + } + + public ContainerResource withParentRelationship(ResourceBuilderBase parent) { + return withParentRelationship(new IResource(parent.getHandle(), parent.getClient())); + } + + /** Sets a child relationship */ + public ContainerResource withChildRelationship(IResource child) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("child", AspireClient.serializeValue(child)); + getClient().invokeCapability("Aspire.Hosting/withChildRelationship", reqArgs); + return this; + } + + public ContainerResource withChildRelationship(ResourceBuilderBase child) { + return withChildRelationship(new IResource(child.getHandle(), child.getClient())); + } + + public ContainerResource withIconName(String iconName) { + return withIconName(iconName, null); + } + + /** Sets the icon for the resource */ + public ContainerResource withIconName(String iconName, IconVariant iconVariant) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("iconName", AspireClient.serializeValue(iconName)); + if (iconVariant != null) { + reqArgs.put("iconVariant", AspireClient.serializeValue(iconVariant)); + } + getClient().invokeCapability("Aspire.Hosting/withIconName", reqArgs); + return this; + } + + /** Adds an HTTP health probe to the resource */ + public ContainerResource withHttpProbe(ProbeType probeType, WithHttpProbeOptions options) { + var path = options == null ? null : options.getPath(); + var initialDelaySeconds = options == null ? null : options.getInitialDelaySeconds(); + var periodSeconds = options == null ? null : options.getPeriodSeconds(); + var timeoutSeconds = options == null ? null : options.getTimeoutSeconds(); + var failureThreshold = options == null ? null : options.getFailureThreshold(); + var successThreshold = options == null ? null : options.getSuccessThreshold(); + var endpointName = options == null ? null : options.getEndpointName(); + return withHttpProbeImpl(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName); + } + + public ContainerResource withHttpProbe(ProbeType probeType) { + return withHttpProbe(probeType, null); + } + + /** Adds an HTTP health probe to the resource */ + private ContainerResource withHttpProbeImpl(ProbeType probeType, String path, Double initialDelaySeconds, Double periodSeconds, Double timeoutSeconds, Double failureThreshold, Double successThreshold, String endpointName) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("probeType", AspireClient.serializeValue(probeType)); + if (path != null) { + reqArgs.put("path", AspireClient.serializeValue(path)); + } + if (initialDelaySeconds != null) { + reqArgs.put("initialDelaySeconds", AspireClient.serializeValue(initialDelaySeconds)); + } + if (periodSeconds != null) { + reqArgs.put("periodSeconds", AspireClient.serializeValue(periodSeconds)); + } + if (timeoutSeconds != null) { + reqArgs.put("timeoutSeconds", AspireClient.serializeValue(timeoutSeconds)); + } + if (failureThreshold != null) { + reqArgs.put("failureThreshold", AspireClient.serializeValue(failureThreshold)); + } + if (successThreshold != null) { + reqArgs.put("successThreshold", AspireClient.serializeValue(successThreshold)); + } + if (endpointName != null) { + reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + } + getClient().invokeCapability("Aspire.Hosting/withHttpProbe", reqArgs); + return this; + } + + /** Excludes the resource from MCP server exposure */ + public ContainerResource excludeFromMcp() { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + getClient().invokeCapability("Aspire.Hosting/excludeFromMcp", reqArgs); + return this; + } + + /** Sets the remote image name for publishing */ + public ContainerResource withRemoteImageName(String remoteImageName) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("remoteImageName", AspireClient.serializeValue(remoteImageName)); + getClient().invokeCapability("Aspire.Hosting/withRemoteImageName", reqArgs); + return this; + } + + /** Sets the remote image tag for publishing */ + public ContainerResource withRemoteImageTag(String remoteImageTag) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("remoteImageTag", AspireClient.serializeValue(remoteImageTag)); + getClient().invokeCapability("Aspire.Hosting/withRemoteImageTag", reqArgs); + return this; + } + + /** Adds a pipeline step to the resource */ + public ContainerResource withPipelineStepFactory(String stepName, AspireAction1 callback, WithPipelineStepFactoryOptions options) { + var dependsOn = options == null ? null : options.getDependsOn(); + var requiredBy = options == null ? null : options.getRequiredBy(); + var tags = options == null ? null : options.getTags(); + var description = options == null ? null : options.getDescription(); + return withPipelineStepFactoryImpl(stepName, callback, dependsOn, requiredBy, tags, description); + } + + public ContainerResource withPipelineStepFactory(String stepName, AspireAction1 callback) { + return withPipelineStepFactory(stepName, callback, null); + } + + /** Adds a pipeline step to the resource */ + private ContainerResource withPipelineStepFactoryImpl(String stepName, AspireAction1 callback, String[] dependsOn, String[] requiredBy, String[] tags, String description) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("stepName", AspireClient.serializeValue(stepName)); + var callbackId = getClient().registerCallback(args -> { + var arg = (PipelineStepContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + if (dependsOn != null) { + reqArgs.put("dependsOn", AspireClient.serializeValue(dependsOn)); + } + if (requiredBy != null) { + reqArgs.put("requiredBy", AspireClient.serializeValue(requiredBy)); + } + if (tags != null) { + reqArgs.put("tags", AspireClient.serializeValue(tags)); + } + if (description != null) { + reqArgs.put("description", AspireClient.serializeValue(description)); + } + getClient().invokeCapability("Aspire.Hosting/withPipelineStepFactory", reqArgs); + return this; + } + + /** Configures pipeline step dependencies via an async callback */ + public ContainerResource withPipelineConfigurationAsync(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (PipelineConfigurationContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withPipelineConfigurationAsync", reqArgs); + return this; + } + + /** Configures pipeline step dependencies via a callback */ + public ContainerResource withPipelineConfiguration(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var obj = (PipelineConfigurationContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withPipelineConfiguration", reqArgs); + return this; + } + + /** Adds a volume */ + public ContainerResource withVolume(String target, WithVolumeOptions options) { + var name = options == null ? null : options.getName(); + var isReadOnly = options == null ? null : options.isReadOnly(); + return withVolumeImpl(target, name, isReadOnly); + } + + public ContainerResource withVolume(String target) { + return withVolume(target, null); + } + + /** Adds a volume */ + private ContainerResource withVolumeImpl(String target, String name, Boolean isReadOnly) { + Map reqArgs = new HashMap<>(); + reqArgs.put("resource", AspireClient.serializeValue(getHandle())); + reqArgs.put("target", AspireClient.serializeValue(target)); + if (name != null) { + reqArgs.put("name", AspireClient.serializeValue(name)); + } + if (isReadOnly != null) { + reqArgs.put("isReadOnly", AspireClient.serializeValue(isReadOnly)); + } + getClient().invokeCapability("Aspire.Hosting/withVolume", reqArgs); + return this; + } + + /** Gets the resource name */ + public String getResourceName() { + Map reqArgs = new HashMap<>(); + reqArgs.put("resource", AspireClient.serializeValue(getHandle())); + return (String) getClient().invokeCapability("Aspire.Hosting/getResourceName", reqArgs); + } + + /** Subscribes to the BeforeResourceStarted event */ + public ContainerResource onBeforeResourceStarted(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (BeforeResourceStartedEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onBeforeResourceStarted", reqArgs); + return this; + } + + /** Subscribes to the ResourceStopped event */ + public ContainerResource onResourceStopped(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceStoppedEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onResourceStopped", reqArgs); + return this; + } + + /** Subscribes to the InitializeResource event */ + public ContainerResource onInitializeResource(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (InitializeResourceEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onInitializeResource", reqArgs); + return this; + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + public ContainerResource onResourceEndpointsAllocated(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceEndpointsAllocatedEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onResourceEndpointsAllocated", reqArgs); + return this; + } + + /** Subscribes to the ResourceReady event */ + public ContainerResource onResourceReady(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceReadyEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onResourceReady", reqArgs); + return this; + } + + /** Adds an optional string parameter */ + public ContainerResource withOptionalString(WithOptionalStringOptions options) { + var value = options == null ? null : options.getValue(); + var enabled = options == null ? null : options.getEnabled(); + return withOptionalStringImpl(value, enabled); + } + + public ContainerResource withOptionalString() { + return withOptionalString(null); + } + + /** Adds an optional string parameter */ + private ContainerResource withOptionalStringImpl(String value, Boolean enabled) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + if (value != null) { + reqArgs.put("value", AspireClient.serializeValue(value)); + } + if (enabled != null) { + reqArgs.put("enabled", AspireClient.serializeValue(enabled)); + } + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalString", reqArgs); + return this; + } + + /** Configures the resource with a DTO */ + public ContainerResource withConfig(TestConfigDto config) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("config", AspireClient.serializeValue(config)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConfig", reqArgs); + return this; + } + + /** Configures environment with callback (test version) */ + public ContainerResource testWithEnvironmentCallback(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (TestEnvironmentContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWithEnvironmentCallback", reqArgs); + return this; + } + + /** Sets the created timestamp */ + public ContainerResource withCreatedAt(String createdAt) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("createdAt", AspireClient.serializeValue(createdAt)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCreatedAt", reqArgs); + return this; + } + + /** Sets the modified timestamp */ + public ContainerResource withModifiedAt(String modifiedAt) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("modifiedAt", AspireClient.serializeValue(modifiedAt)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withModifiedAt", reqArgs); + return this; + } + + /** Sets the correlation ID */ + public ContainerResource withCorrelationId(String correlationId) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("correlationId", AspireClient.serializeValue(correlationId)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCorrelationId", reqArgs); + return this; } - public String getValue() { return value; } + public ContainerResource withOptionalCallback() { + return withOptionalCallback(null); + } - public static UrlDisplayLocation fromValue(String value) { - for (UrlDisplayLocation e : values()) { - if (e.value.equals(value)) return e; + /** Configures with optional callback */ + public ContainerResource withOptionalCallback(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = callback == null ? null : getClient().registerCallback(args -> { + var arg = (TestCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - throw new IllegalArgumentException("Unknown value: " + value); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalCallback", reqArgs); + return this; } -} -/** TestPersistenceMode enum. */ -enum TestPersistenceMode { - NONE("None"), - VOLUME("Volume"), - BIND("Bind"); + /** Sets the resource status */ + public ContainerResource withStatus(TestResourceStatus status) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("status", AspireClient.serializeValue(status)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withStatus", reqArgs); + return this; + } - private final String value; + /** Configures with nested DTO */ + public ContainerResource withNestedConfig(TestNestedDto config) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("config", AspireClient.serializeValue(config)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withNestedConfig", reqArgs); + return this; + } - TestPersistenceMode(String value) { - this.value = value; + /** Adds validation callback */ + public ContainerResource withValidator(AspireFunc1 validator) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var validatorId = getClient().registerCallback(args -> { + var arg = (TestResourceContext) args[0]; + return AspireClient.awaitValue(validator.invoke(arg)); + }); + if (validatorId != null) { + reqArgs.put("validator", validatorId); + } + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withValidator", reqArgs); + return this; } - public String getValue() { return value; } + /** Waits for another resource (test version) */ + public ContainerResource testWaitFor(IResource dependency) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWaitFor", reqArgs); + return this; + } - public static TestPersistenceMode fromValue(String value) { - for (TestPersistenceMode e : values()) { - if (e.value.equals(value)) return e; - } - throw new IllegalArgumentException("Unknown value: " + value); + public ContainerResource testWaitFor(ResourceBuilderBase dependency) { + return testWaitFor(new IResource(dependency.getHandle(), dependency.getClient())); } -} -/** TestResourceStatus enum. */ -enum TestResourceStatus { - PENDING("Pending"), - RUNNING("Running"), - STOPPED("Stopped"), - FAILED("Failed"); + /** Adds a dependency on another resource */ + public ContainerResource withDependency(IResourceWithConnectionString dependency) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDependency", reqArgs); + return this; + } - private final String value; + public ContainerResource withDependency(ResourceBuilderBase dependency) { + return withDependency(new IResourceWithConnectionString(dependency.getHandle(), dependency.getClient())); + } - TestResourceStatus(String value) { - this.value = value; + /** Sets the endpoints */ + public ContainerResource withEndpoints(String[] endpoints) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("endpoints", AspireClient.serializeValue(endpoints)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEndpoints", reqArgs); + return this; } - public String getValue() { return value; } + /** Sets environment variables */ + public ContainerResource withEnvironmentVariables(Map variables) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("variables", AspireClient.serializeValue(variables)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEnvironmentVariables", reqArgs); + return this; + } - public static TestResourceStatus fromValue(String value) { - for (TestResourceStatus e : values()) { - if (e.value.equals(value)) return e; + /** Performs a cancellable operation */ + public ContainerResource withCancellableOperation(AspireAction1 operation) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var operationId = getClient().registerCallback(args -> { + var arg = CancellationToken.fromValue(args[0]); + operation.invoke(arg); + return null; + }); + if (operationId != null) { + reqArgs.put("operation", operationId); } - throw new IllegalArgumentException("Unknown value: " + value); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCancellableOperation", reqArgs); + return this; } + } -// ============================================================================ -// DTOs -// ============================================================================ +// ===== CreateBuilderOptions.java ===== +// CreateBuilderOptions.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; /** CreateBuilderOptions DTO. */ -class CreateBuilderOptions { +public class CreateBuilderOptions { private String[] args; private String projectDirectory; private String appHostFilePath; @@ -367,282 +5594,262 @@ public Map toMap() { } } -/** ResourceEventDto DTO. */ -class ResourceEventDto { - private String resourceName; - private String resourceId; - private String state; - private String stateStyle; - private String healthStatus; - private double exitCode; - - public String getResourceName() { return resourceName; } - public void setResourceName(String value) { this.resourceName = value; } - public String getResourceId() { return resourceId; } - public void setResourceId(String value) { this.resourceId = value; } - public String getState() { return state; } - public void setState(String value) { this.state = value; } - public String getStateStyle() { return stateStyle; } - public void setStateStyle(String value) { this.stateStyle = value; } - public String getHealthStatus() { return healthStatus; } - public void setHealthStatus(String value) { this.healthStatus = value; } - public double getExitCode() { return exitCode; } - public void setExitCode(double value) { this.exitCode = value; } - - public Map toMap() { - Map map = new HashMap<>(); - map.put("ResourceName", AspireClient.serializeValue(resourceName)); - map.put("ResourceId", AspireClient.serializeValue(resourceId)); - map.put("State", AspireClient.serializeValue(state)); - map.put("StateStyle", AspireClient.serializeValue(stateStyle)); - map.put("HealthStatus", AspireClient.serializeValue(healthStatus)); - map.put("ExitCode", AspireClient.serializeValue(exitCode)); - return map; - } -} +// ===== DistributedApplication.java ===== +// DistributedApplication.java - GENERATED CODE - DO NOT EDIT -/** CommandOptions DTO. */ -class CommandOptions { - private String description; - private Object parameter; - private String confirmationMessage; - private String iconName; - private IconVariant iconVariant; - private boolean isHighlighted; - private Object updateState; +package aspire; - public String getDescription() { return description; } - public void setDescription(String value) { this.description = value; } - public Object getParameter() { return parameter; } - public void setParameter(Object value) { this.parameter = value; } - public String getConfirmationMessage() { return confirmationMessage; } - public void setConfirmationMessage(String value) { this.confirmationMessage = value; } - public String getIconName() { return iconName; } - public void setIconName(String value) { this.iconName = value; } - public IconVariant getIconVariant() { return iconVariant; } - public void setIconVariant(IconVariant value) { this.iconVariant = value; } - public boolean getIsHighlighted() { return isHighlighted; } - public void setIsHighlighted(boolean value) { this.isHighlighted = value; } - public Object getUpdateState() { return updateState; } - public void setUpdateState(Object value) { this.updateState = value; } +import java.util.*; +import java.util.function.*; - public Map toMap() { - Map map = new HashMap<>(); - map.put("Description", AspireClient.serializeValue(description)); - map.put("Parameter", AspireClient.serializeValue(parameter)); - map.put("ConfirmationMessage", AspireClient.serializeValue(confirmationMessage)); - map.put("IconName", AspireClient.serializeValue(iconName)); - map.put("IconVariant", AspireClient.serializeValue(iconVariant)); - map.put("IsHighlighted", AspireClient.serializeValue(isHighlighted)); - map.put("UpdateState", AspireClient.serializeValue(updateState)); - return map; +/** Wrapper for Aspire.Hosting/Aspire.Hosting.DistributedApplication. */ +public class DistributedApplication extends HandleWrapperBase { + DistributedApplication(Handle handle, AspireClient client) { + super(handle, client); } -} - -/** ExecuteCommandResult DTO. */ -class ExecuteCommandResult { - private boolean success; - private boolean canceled; - private String errorMessage; - - public boolean getSuccess() { return success; } - public void setSuccess(boolean value) { this.success = value; } - public boolean getCanceled() { return canceled; } - public void setCanceled(boolean value) { this.canceled = value; } - public String getErrorMessage() { return errorMessage; } - public void setErrorMessage(String value) { this.errorMessage = value; } - public Map toMap() { - Map map = new HashMap<>(); - map.put("Success", AspireClient.serializeValue(success)); - map.put("Canceled", AspireClient.serializeValue(canceled)); - map.put("ErrorMessage", AspireClient.serializeValue(errorMessage)); - return map; + public void run() { + run(null); } -} - -/** ResourceUrlAnnotation DTO. */ -class ResourceUrlAnnotation { - private String url; - private String displayText; - private EndpointReference endpoint; - private UrlDisplayLocation displayLocation; - - public String getUrl() { return url; } - public void setUrl(String value) { this.url = value; } - public String getDisplayText() { return displayText; } - public void setDisplayText(String value) { this.displayText = value; } - public EndpointReference getEndpoint() { return endpoint; } - public void setEndpoint(EndpointReference value) { this.endpoint = value; } - public UrlDisplayLocation getDisplayLocation() { return displayLocation; } - public void setDisplayLocation(UrlDisplayLocation value) { this.displayLocation = value; } - public Map toMap() { - Map map = new HashMap<>(); - map.put("Url", AspireClient.serializeValue(url)); - map.put("DisplayText", AspireClient.serializeValue(displayText)); - map.put("Endpoint", AspireClient.serializeValue(endpoint)); - map.put("DisplayLocation", AspireClient.serializeValue(displayLocation)); - return map; + /** Runs the distributed application */ + public void run(CancellationToken cancellationToken) { + Map reqArgs = new HashMap<>(); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + if (cancellationToken != null) { + reqArgs.put("cancellationToken", getClient().registerCancellation(cancellationToken)); + } + getClient().invokeCapability("Aspire.Hosting/run", reqArgs); } -} - -/** TestConfigDto DTO. */ -class TestConfigDto { - private String name; - private double port; - private boolean enabled; - private String optionalField; - - public String getName() { return name; } - public void setName(String value) { this.name = value; } - public double getPort() { return port; } - public void setPort(double value) { this.port = value; } - public boolean getEnabled() { return enabled; } - public void setEnabled(boolean value) { this.enabled = value; } - public String getOptionalField() { return optionalField; } - public void setOptionalField(String value) { this.optionalField = value; } - public Map toMap() { - Map map = new HashMap<>(); - map.put("Name", AspireClient.serializeValue(name)); - map.put("Port", AspireClient.serializeValue(port)); - map.put("Enabled", AspireClient.serializeValue(enabled)); - map.put("OptionalField", AspireClient.serializeValue(optionalField)); - return map; + /** Create a new distributed application builder. */ + public static IDistributedApplicationBuilder CreateBuilder() throws Exception { + return CreateBuilder((String[]) null); } -} - -/** TestNestedDto DTO. */ -class TestNestedDto { - private String id; - private TestConfigDto config; - private AspireList tags; - private AspireDict counts; - - public String getId() { return id; } - public void setId(String value) { this.id = value; } - public TestConfigDto getConfig() { return config; } - public void setConfig(TestConfigDto value) { this.config = value; } - public AspireList getTags() { return tags; } - public void setTags(AspireList value) { this.tags = value; } - public AspireDict getCounts() { return counts; } - public void setCounts(AspireDict value) { this.counts = value; } - - public Map toMap() { - Map map = new HashMap<>(); - map.put("Id", AspireClient.serializeValue(id)); - map.put("Config", AspireClient.serializeValue(config)); - map.put("Tags", AspireClient.serializeValue(tags)); - map.put("Counts", AspireClient.serializeValue(counts)); - return map; + + /** Create a new distributed application builder. */ + public static IDistributedApplicationBuilder CreateBuilder(String[] args) throws Exception { + CreateBuilderOptions options = new CreateBuilderOptions(); + if (args != null) { + options.setArgs(args); + } + return CreateBuilder(options); + } + + /** Create a new distributed application builder. */ + public static IDistributedApplicationBuilder CreateBuilder(CreateBuilderOptions options) throws Exception { + return Aspire.createBuilder(options); } + } -/** TestDeeplyNestedDto DTO. */ -class TestDeeplyNestedDto { - private AspireDict> nestedData; - private AspireDict[] metadataArray; +// ===== DistributedApplicationEventSubscription.java ===== +// DistributedApplicationEventSubscription.java - GENERATED CODE - DO NOT EDIT - public AspireDict> getNestedData() { return nestedData; } - public void setNestedData(AspireDict> value) { this.nestedData = value; } - public AspireDict[] getMetadataArray() { return metadataArray; } - public void setMetadataArray(AspireDict[] value) { this.metadataArray = value; } +package aspire; - public Map toMap() { - Map map = new HashMap<>(); - map.put("NestedData", AspireClient.serializeValue(nestedData)); - map.put("MetadataArray", AspireClient.serializeValue(metadataArray)); - return map; +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.Eventing.DistributedApplicationEventSubscription. */ +public class DistributedApplicationEventSubscription extends HandleWrapperBase { + DistributedApplicationEventSubscription(Handle handle, AspireClient client) { + super(handle, client); } + } -// ============================================================================ -// Handle Wrappers -// ============================================================================ +// ===== DistributedApplicationExecutionContext.java ===== +// DistributedApplicationExecutionContext.java - GENERATED CODE - DO NOT EDIT -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.AfterResourcesCreatedEvent. */ -class AfterResourcesCreatedEvent extends HandleWrapperBase { - AfterResourcesCreatedEvent(Handle handle, AspireClient client) { +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext. */ +public class DistributedApplicationExecutionContext extends HandleWrapperBase { + DistributedApplicationExecutionContext(Handle handle, AspireClient client) { super(handle, client); } - /** Gets the Services property */ - public IServiceProvider services() { + /** Gets the PublisherName property */ + public String publisherName() { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (IServiceProvider) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.services", reqArgs); + return (String) getClient().invokeCapability("Aspire.Hosting/DistributedApplicationExecutionContext.publisherName", reqArgs); } - /** Gets the Model property */ - public DistributedApplicationModel model() { + /** Sets the PublisherName property */ + public DistributedApplicationExecutionContext setPublisherName(String value) { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (DistributedApplicationModel) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/AfterResourcesCreatedEvent.model", reqArgs); + reqArgs.put("value", AspireClient.serializeValue(value)); + return (DistributedApplicationExecutionContext) getClient().invokeCapability("Aspire.Hosting/DistributedApplicationExecutionContext.setPublisherName", reqArgs); } -} + /** Gets the Operation property */ + public DistributedApplicationOperation operation() { + Map reqArgs = new HashMap<>(); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (DistributedApplicationOperation) getClient().invokeCapability("Aspire.Hosting/DistributedApplicationExecutionContext.operation", reqArgs); + } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent. */ -class BeforeResourceStartedEvent extends HandleWrapperBase { - BeforeResourceStartedEvent(Handle handle, AspireClient client) { - super(handle, client); + /** Gets the ServiceProvider property */ + public IServiceProvider serviceProvider() { + Map reqArgs = new HashMap<>(); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (IServiceProvider) getClient().invokeCapability("Aspire.Hosting/DistributedApplicationExecutionContext.serviceProvider", reqArgs); } - /** Gets the Resource property */ - public IResource resource() { + /** Gets the IsPublishMode property */ + public boolean isPublishMode() { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.resource", reqArgs); + return (boolean) getClient().invokeCapability("Aspire.Hosting/DistributedApplicationExecutionContext.isPublishMode", reqArgs); } - /** Gets the Services property */ - public IServiceProvider services() { + /** Gets the IsRunMode property */ + public boolean isRunMode() { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (IServiceProvider) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/BeforeResourceStartedEvent.services", reqArgs); + return (boolean) getClient().invokeCapability("Aspire.Hosting/DistributedApplicationExecutionContext.isRunMode", reqArgs); } } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeStartEvent. */ -class BeforeStartEvent extends HandleWrapperBase { - BeforeStartEvent(Handle handle, AspireClient client) { +// ===== DistributedApplicationExecutionContextOptions.java ===== +// DistributedApplicationExecutionContextOptions.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContextOptions. */ +public class DistributedApplicationExecutionContextOptions extends HandleWrapperBase { + DistributedApplicationExecutionContextOptions(Handle handle, AspireClient client) { super(handle, client); } - /** Gets the Services property */ - public IServiceProvider services() { +} + +// ===== DistributedApplicationModel.java ===== +// DistributedApplicationModel.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel. */ +public class DistributedApplicationModel extends HandleWrapperBase { + DistributedApplicationModel(Handle handle, AspireClient client) { + super(handle, client); + } + + /** Gets resources from the distributed application model */ + public IResource[] getResources() { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (IServiceProvider) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/BeforeStartEvent.services", reqArgs); + reqArgs.put("model", AspireClient.serializeValue(getHandle())); + return (IResource[]) getClient().invokeCapability("Aspire.Hosting/getResources", reqArgs); } - /** Gets the Model property */ - public DistributedApplicationModel model() { + /** Finds a resource by name */ + public IResource findResourceByName(String name) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (DistributedApplicationModel) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/BeforeStartEvent.model", reqArgs); + reqArgs.put("model", AspireClient.serializeValue(getHandle())); + reqArgs.put("name", AspireClient.serializeValue(name)); + return (IResource) getClient().invokeCapability("Aspire.Hosting/findResourceByName", reqArgs); } } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource. */ -class CSharpAppResource extends ResourceBuilderBase { - CSharpAppResource(Handle handle, AspireClient client) { +// ===== DistributedApplicationOperation.java ===== +// DistributedApplicationOperation.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** DistributedApplicationOperation enum. */ +public enum DistributedApplicationOperation implements WireValueEnum { + RUN("Run"), + PUBLISH("Publish"); + + private final String value; + + DistributedApplicationOperation(String value) { + this.value = value; + } + + public String getValue() { return value; } + + public static DistributedApplicationOperation fromValue(String value) { + for (DistributedApplicationOperation e : values()) { + if (e.value.equals(value)) return e; + } + throw new IllegalArgumentException("Unknown value: " + value); + } +} + +// ===== DistributedApplicationResourceEventSubscription.java ===== +// DistributedApplicationResourceEventSubscription.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.Eventing.DistributedApplicationResourceEventSubscription. */ +public class DistributedApplicationResourceEventSubscription extends HandleWrapperBase { + DistributedApplicationResourceEventSubscription(Handle handle, AspireClient client) { + super(handle, client); + } + +} + +// ===== DotnetToolResource.java ===== +// DotnetToolResource.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource. */ +public class DotnetToolResource extends ResourceBuilderBase { + DotnetToolResource(Handle handle, AspireClient client) { super(handle, client); } /** Configures a resource to use a container registry */ - public IResource withContainerRegistry(IResource registry) { + public DotnetToolResource withContainerRegistry(IResource registry) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("registry", AspireClient.serializeValue(registry)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withContainerRegistry", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withContainerRegistry", reqArgs); + return this; + } + + public DotnetToolResource withContainerRegistry(ResourceBuilderBase registry) { + return withContainerRegistry(new IResource(registry.getHandle(), registry.getClient())); + } + + /** Sets the base image for a Dockerfile build */ + public DotnetToolResource withDockerfileBaseImage(WithDockerfileBaseImageOptions options) { + var buildImage = options == null ? null : options.getBuildImage(); + var runtimeImage = options == null ? null : options.getRuntimeImage(); + return withDockerfileBaseImageImpl(buildImage, runtimeImage); + } + + public DotnetToolResource withDockerfileBaseImage() { + return withDockerfileBaseImage(null); } /** Sets the base image for a Dockerfile build */ - public IResource withDockerfileBaseImage(String buildImage, String runtimeImage) { + private DotnetToolResource withDockerfileBaseImageImpl(String buildImage, String runtimeImage) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); if (buildImage != null) { @@ -651,168 +5858,310 @@ public IResource withDockerfileBaseImage(String buildImage, String runtimeImage) if (runtimeImage != null) { reqArgs.put("runtimeImage", AspireClient.serializeValue(runtimeImage)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withDockerfileBaseImage", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withDockerfileBaseImage", reqArgs); + return this; } - /** Configures an MCP server endpoint on the resource */ - public IResourceWithEndpoints withMcpServer(String path, String endpointName) { + /** Sets the tool package ID */ + public DotnetToolResource withToolPackage(String packageId) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (path != null) { - reqArgs.put("path", AspireClient.serializeValue(path)); - } - if (endpointName != null) { - reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); - } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withMcpServer", reqArgs); + reqArgs.put("packageId", AspireClient.serializeValue(packageId)); + getClient().invokeCapability("Aspire.Hosting/withToolPackage", reqArgs); + return this; } - /** Configures OTLP telemetry export */ - public IResourceWithEnvironment withOtlpExporter() { + /** Sets the tool version */ + public DotnetToolResource withToolVersion(String version) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withOtlpExporter", reqArgs); + reqArgs.put("version", AspireClient.serializeValue(version)); + getClient().invokeCapability("Aspire.Hosting/withToolVersion", reqArgs); + return this; } - /** Configures OTLP telemetry export with specific protocol */ - public IResourceWithEnvironment withOtlpExporterProtocol(OtlpProtocol protocol) { + /** Allows prerelease tool versions */ + public DotnetToolResource withToolPrerelease() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("protocol", AspireClient.serializeValue(protocol)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withOtlpExporterProtocol", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withToolPrerelease", reqArgs); + return this; } - /** Sets the number of replicas */ - public ProjectResource withReplicas(double replicas) { + /** Adds a NuGet source for the tool */ + public DotnetToolResource withToolSource(String source) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("replicas", AspireClient.serializeValue(replicas)); - return (ProjectResource) getClient().invokeCapability("Aspire.Hosting/withReplicas", reqArgs); + reqArgs.put("source", AspireClient.serializeValue(source)); + getClient().invokeCapability("Aspire.Hosting/withToolSource", reqArgs); + return this; } - /** Disables forwarded headers for the project */ - public ProjectResource disableForwardedHeaders() { + /** Ignores existing NuGet feeds */ + public DotnetToolResource withToolIgnoreExistingFeeds() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (ProjectResource) getClient().invokeCapability("Aspire.Hosting/disableForwardedHeaders", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withToolIgnoreExistingFeeds", reqArgs); + return this; } - /** Publishes a project as a Docker file with optional container configuration */ - public ProjectResource publishAsDockerFile(Function configure) { + /** Ignores failed NuGet sources */ + public DotnetToolResource withToolIgnoreFailedSources() { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + getClient().invokeCapability("Aspire.Hosting/withToolIgnoreFailedSources", reqArgs); + return this; + } + + /** Publishes the executable as a Docker container */ + public DotnetToolResource publishAsDockerFile() { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + getClient().invokeCapability("Aspire.Hosting/publishAsDockerFile", reqArgs); + return this; + } + + /** Publishes an executable as a Docker file with optional container configuration */ + public DotnetToolResource publishAsDockerFileWithConfigure(AspireAction1 configure) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var configureId = getClient().registerCallback(args -> { + var obj = (ContainerResource) args[0]; + configure.invoke(obj); + return null; + }); + if (configureId != null) { + reqArgs.put("configure", configureId); + } + getClient().invokeCapability("Aspire.Hosting/publishAsDockerFileWithConfigure", reqArgs); + return this; + } + + /** Sets the executable command */ + public DotnetToolResource withExecutableCommand(String command) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("command", AspireClient.serializeValue(command)); + getClient().invokeCapability("Aspire.Hosting/withExecutableCommand", reqArgs); + return this; + } + + /** Sets the executable working directory */ + public DotnetToolResource withWorkingDirectory(String workingDirectory) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("workingDirectory", AspireClient.serializeValue(workingDirectory)); + getClient().invokeCapability("Aspire.Hosting/withWorkingDirectory", reqArgs); + return this; + } + + /** Configures an MCP server endpoint on the resource */ + public DotnetToolResource withMcpServer(WithMcpServerOptions options) { + var path = options == null ? null : options.getPath(); + var endpointName = options == null ? null : options.getEndpointName(); + return withMcpServerImpl(path, endpointName); + } + + public DotnetToolResource withMcpServer() { + return withMcpServer(null); + } + + /** Configures an MCP server endpoint on the resource */ + private DotnetToolResource withMcpServerImpl(String path, String endpointName) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (configure != null) { - reqArgs.put("configure", getClient().registerCallback(configure)); + if (path != null) { + reqArgs.put("path", AspireClient.serializeValue(path)); + } + if (endpointName != null) { + reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); } - return (ProjectResource) getClient().invokeCapability("Aspire.Hosting/publishProjectAsDockerFileWithConfigure", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withMcpServer", reqArgs); + return this; + } + + /** Configures OTLP telemetry export */ + public DotnetToolResource withOtlpExporter() { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + getClient().invokeCapability("Aspire.Hosting/withOtlpExporter", reqArgs); + return this; + } + + /** Configures OTLP telemetry export with specific protocol */ + public DotnetToolResource withOtlpExporterProtocol(OtlpProtocol protocol) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("protocol", AspireClient.serializeValue(protocol)); + getClient().invokeCapability("Aspire.Hosting/withOtlpExporterProtocol", reqArgs); + return this; + } + + public DotnetToolResource withRequiredCommand(String command) { + return withRequiredCommand(command, null); } /** Adds a required command dependency */ - public IResource withRequiredCommand(String command, String helpLink) { + public DotnetToolResource withRequiredCommand(String command, String helpLink) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("command", AspireClient.serializeValue(command)); if (helpLink != null) { reqArgs.put("helpLink", AspireClient.serializeValue(helpLink)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withRequiredCommand", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withRequiredCommand", reqArgs); + return this; } /** Sets an environment variable */ - public IResourceWithEnvironment withEnvironment(String name, String value) { + public DotnetToolResource withEnvironment(String name, String value) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("name", AspireClient.serializeValue(name)); reqArgs.put("value", AspireClient.serializeValue(value)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironment", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withEnvironment", reqArgs); + return this; } /** Adds an environment variable with a reference expression */ - public IResourceWithEnvironment withEnvironmentExpression(String name, ReferenceExpression value) { + public DotnetToolResource withEnvironmentExpression(String name, ReferenceExpression value) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("name", AspireClient.serializeValue(name)); reqArgs.put("value", AspireClient.serializeValue(value)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentExpression", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentExpression", reqArgs); + return this; } /** Sets environment variables via callback */ - public IResourceWithEnvironment withEnvironmentCallback(Function callback) { + public DotnetToolResource withEnvironmentCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var obj = (EnvironmentCallbackContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentCallback", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentCallback", reqArgs); + return this; } /** Sets environment variables via async callback */ - public IResourceWithEnvironment withEnvironmentCallbackAsync(Function callback) { + public DotnetToolResource withEnvironmentCallbackAsync(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var arg = (EnvironmentCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentCallbackAsync", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentCallbackAsync", reqArgs); + return this; } /** Sets an environment variable from an endpoint reference */ - public IResourceWithEnvironment withEnvironmentEndpoint(String name, EndpointReference endpointReference) { + public DotnetToolResource withEnvironmentEndpoint(String name, EndpointReference endpointReference) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("name", AspireClient.serializeValue(name)); reqArgs.put("endpointReference", AspireClient.serializeValue(endpointReference)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentEndpoint", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentEndpoint", reqArgs); + return this; } /** Sets an environment variable from a parameter resource */ - public IResourceWithEnvironment withEnvironmentParameter(String name, ParameterResource parameter) { + public DotnetToolResource withEnvironmentParameter(String name, ParameterResource parameter) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("name", AspireClient.serializeValue(name)); reqArgs.put("parameter", AspireClient.serializeValue(parameter)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentParameter", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentParameter", reqArgs); + return this; } /** Sets an environment variable from a connection string resource */ - public IResourceWithEnvironment withEnvironmentConnectionString(String envVarName, IResourceWithConnectionString resource) { + public DotnetToolResource withEnvironmentConnectionString(String envVarName, IResourceWithConnectionString resource) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("envVarName", AspireClient.serializeValue(envVarName)); reqArgs.put("resource", AspireClient.serializeValue(resource)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentConnectionString", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentConnectionString", reqArgs); + return this; + } + + public DotnetToolResource withEnvironmentConnectionString(String envVarName, ResourceBuilderBase resource) { + return withEnvironmentConnectionString(envVarName, new IResourceWithConnectionString(resource.getHandle(), resource.getClient())); } /** Adds arguments */ - public IResourceWithArgs withArgs(String[] args) { + public DotnetToolResource withArgs(String[] args) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("args", AspireClient.serializeValue(args)); - return (IResourceWithArgs) getClient().invokeCapability("Aspire.Hosting/withArgs", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withArgs", reqArgs); + return this; } /** Sets command-line arguments via callback */ - public IResourceWithArgs withArgsCallback(Function callback) { + public DotnetToolResource withArgsCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var obj = (CommandLineArgsCallbackContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResourceWithArgs) getClient().invokeCapability("Aspire.Hosting/withArgsCallback", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withArgsCallback", reqArgs); + return this; } /** Sets command-line arguments via async callback */ - public IResourceWithArgs withArgsCallbackAsync(Function callback) { + public DotnetToolResource withArgsCallbackAsync(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var arg = (CommandLineArgsCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResourceWithArgs) getClient().invokeCapability("Aspire.Hosting/withArgsCallbackAsync", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withArgsCallbackAsync", reqArgs); + return this; } /** Adds a reference to another resource */ - public IResourceWithEnvironment withReference(IResource source, String connectionName, Boolean optional, String name) { + public DotnetToolResource withReference(IResource source, WithReferenceOptions options) { + var connectionName = options == null ? null : options.getConnectionName(); + var optional = options == null ? null : options.getOptional(); + var name = options == null ? null : options.getName(); + return withReferenceImpl(source, connectionName, optional, name); + } + + public DotnetToolResource withReference(ResourceBuilderBase source, WithReferenceOptions options) { + return withReference(new IResource(source.getHandle(), source.getClient()), options); + } + + public DotnetToolResource withReference(IResource source) { + return withReference(source, null); + } + + public DotnetToolResource withReference(ResourceBuilderBase source) { + return withReference(new IResource(source.getHandle(), source.getClient())); + } + + /** Adds a reference to another resource */ + private DotnetToolResource withReferenceImpl(IResource source, String connectionName, Boolean optional, String name) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("source", AspireClient.serializeValue(source)); @@ -825,36 +6174,57 @@ public IResourceWithEnvironment withReference(IResource source, String connectio if (name != null) { reqArgs.put("name", AspireClient.serializeValue(name)); } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withReference", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withReference", reqArgs); + return this; } /** Adds a reference to a URI */ - public IResourceWithEnvironment withReferenceUri(String name, String uri) { + public DotnetToolResource withReferenceUri(String name, String uri) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("name", AspireClient.serializeValue(name)); reqArgs.put("uri", AspireClient.serializeValue(uri)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withReferenceUri", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withReferenceUri", reqArgs); + return this; } /** Adds a reference to an external service */ - public IResourceWithEnvironment withReferenceExternalService(ExternalServiceResource externalService) { + public DotnetToolResource withReferenceExternalService(ExternalServiceResource externalService) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("externalService", AspireClient.serializeValue(externalService)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withReferenceExternalService", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withReferenceExternalService", reqArgs); + return this; } /** Adds a reference to an endpoint */ - public IResourceWithEnvironment withReferenceEndpoint(EndpointReference endpointReference) { + public DotnetToolResource withReferenceEndpoint(EndpointReference endpointReference) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("endpointReference", AspireClient.serializeValue(endpointReference)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withReferenceEndpoint", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withReferenceEndpoint", reqArgs); + return this; + } + + /** Adds a network endpoint */ + public DotnetToolResource withEndpoint(WithEndpointOptions options) { + var port = options == null ? null : options.getPort(); + var targetPort = options == null ? null : options.getTargetPort(); + var scheme = options == null ? null : options.getScheme(); + var name = options == null ? null : options.getName(); + var env = options == null ? null : options.getEnv(); + var isProxied = options == null ? null : options.isProxied(); + var isExternal = options == null ? null : options.isExternal(); + var protocol = options == null ? null : options.getProtocol(); + return withEndpointImpl(port, targetPort, scheme, name, env, isProxied, isExternal, protocol); + } + + public DotnetToolResource withEndpoint() { + return withEndpoint(null); } /** Adds a network endpoint */ - public IResourceWithEndpoints withEndpoint(Double port, Double targetPort, String scheme, String name, String env, Boolean isProxied, Boolean isExternal, ProtocolType protocol) { + private DotnetToolResource withEndpointImpl(Double port, Double targetPort, String scheme, String name, String env, Boolean isProxied, Boolean isExternal, ProtocolType protocol) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); if (port != null) { @@ -881,11 +6251,26 @@ public IResourceWithEndpoints withEndpoint(Double port, Double targetPort, Strin if (protocol != null) { reqArgs.put("protocol", AspireClient.serializeValue(protocol)); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withEndpoint", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withEndpoint", reqArgs); + return this; + } + + /** Adds an HTTP endpoint */ + public DotnetToolResource withHttpEndpoint(WithHttpEndpointOptions options) { + var port = options == null ? null : options.getPort(); + var targetPort = options == null ? null : options.getTargetPort(); + var name = options == null ? null : options.getName(); + var env = options == null ? null : options.getEnv(); + var isProxied = options == null ? null : options.isProxied(); + return withHttpEndpointImpl(port, targetPort, name, env, isProxied); + } + + public DotnetToolResource withHttpEndpoint() { + return withHttpEndpoint(null); } /** Adds an HTTP endpoint */ - public IResourceWithEndpoints withHttpEndpoint(Double port, Double targetPort, String name, String env, Boolean isProxied) { + private DotnetToolResource withHttpEndpointImpl(Double port, Double targetPort, String name, String env, Boolean isProxied) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); if (port != null) { @@ -903,11 +6288,26 @@ public IResourceWithEndpoints withHttpEndpoint(Double port, Double targetPort, S if (isProxied != null) { reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withHttpEndpoint", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withHttpEndpoint", reqArgs); + return this; + } + + /** Adds an HTTPS endpoint */ + public DotnetToolResource withHttpsEndpoint(WithHttpsEndpointOptions options) { + var port = options == null ? null : options.getPort(); + var targetPort = options == null ? null : options.getTargetPort(); + var name = options == null ? null : options.getName(); + var env = options == null ? null : options.getEnv(); + var isProxied = options == null ? null : options.isProxied(); + return withHttpsEndpointImpl(port, targetPort, name, env, isProxied); + } + + public DotnetToolResource withHttpsEndpoint() { + return withHttpsEndpoint(null); } /** Adds an HTTPS endpoint */ - public IResourceWithEndpoints withHttpsEndpoint(Double port, Double targetPort, String name, String env, Boolean isProxied) { + private DotnetToolResource withHttpsEndpointImpl(Double port, Double targetPort, String name, String env, Boolean isProxied) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); if (port != null) { @@ -925,14 +6325,16 @@ public IResourceWithEndpoints withHttpsEndpoint(Double port, Double targetPort, if (isProxied != null) { reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withHttpsEndpoint", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withHttpsEndpoint", reqArgs); + return this; } /** Makes HTTP endpoints externally accessible */ - public IResourceWithEndpoints withExternalHttpEndpoints() { + public DotnetToolResource withExternalHttpEndpoints() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withExternalHttpEndpoints", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withExternalHttpEndpoints", reqArgs); + return this; } /** Gets an endpoint reference */ @@ -944,154 +6346,227 @@ public EndpointReference getEndpoint(String name) { } /** Configures resource for HTTP/2 */ - public IResourceWithEndpoints asHttp2Service() { + public DotnetToolResource asHttp2Service() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/asHttp2Service", reqArgs); + getClient().invokeCapability("Aspire.Hosting/asHttp2Service", reqArgs); + return this; } /** Customizes displayed URLs via callback */ - public IResource withUrlsCallback(Function callback) { + public DotnetToolResource withUrlsCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var obj = (ResourceUrlsCallbackContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlsCallback", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrlsCallback", reqArgs); + return this; } /** Customizes displayed URLs via async callback */ - public IResource withUrlsCallbackAsync(Function callback) { + public DotnetToolResource withUrlsCallbackAsync(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceUrlsCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlsCallbackAsync", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrlsCallbackAsync", reqArgs); + return this; + } + + public DotnetToolResource withUrl(String url) { + return withUrl(url, null); } /** Adds or modifies displayed URLs */ - public IResource withUrl(String url, String displayText) { + public DotnetToolResource withUrl(String url, String displayText) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("url", AspireClient.serializeValue(url)); if (displayText != null) { reqArgs.put("displayText", AspireClient.serializeValue(displayText)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrl", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrl", reqArgs); + return this; + } + + public DotnetToolResource withUrlExpression(ReferenceExpression url) { + return withUrlExpression(url, null); } /** Adds a URL using a reference expression */ - public IResource withUrlExpression(ReferenceExpression url, String displayText) { + public DotnetToolResource withUrlExpression(ReferenceExpression url, String displayText) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("url", AspireClient.serializeValue(url)); if (displayText != null) { reqArgs.put("displayText", AspireClient.serializeValue(displayText)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlExpression", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrlExpression", reqArgs); + return this; } /** Customizes the URL for a specific endpoint via callback */ - public IResource withUrlForEndpoint(String endpointName, Function callback) { + public DotnetToolResource withUrlForEndpoint(String endpointName, AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var obj = (ResourceUrlAnnotation) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlForEndpoint", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrlForEndpoint", reqArgs); + return this; } /** Adds a URL for a specific endpoint via factory callback */ - public IResourceWithEndpoints withUrlForEndpointFactory(String endpointName, Function callback) { + public DotnetToolResource withUrlForEndpointFactory(String endpointName, AspireFunc1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var arg = (EndpointReference) args[0]; + return AspireClient.awaitValue(callback.invoke(arg)); + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withUrlForEndpointFactory", reqArgs); - } - - /** Configures the resource to copy container files from the specified source during publishing */ - public IContainerFilesDestinationResource publishWithContainerFiles(IResourceWithContainerFiles source, String destinationPath) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("source", AspireClient.serializeValue(source)); - reqArgs.put("destinationPath", AspireClient.serializeValue(destinationPath)); - return (IContainerFilesDestinationResource) getClient().invokeCapability("Aspire.Hosting/publishWithContainerFiles", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrlForEndpointFactory", reqArgs); + return this; } /** Excludes the resource from the deployment manifest */ - public IResource excludeFromManifest() { + public DotnetToolResource excludeFromManifest() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/excludeFromManifest", reqArgs); + getClient().invokeCapability("Aspire.Hosting/excludeFromManifest", reqArgs); + return this; } /** Waits for another resource to be ready */ - public IResourceWithWaitSupport waitFor(IResource dependency) { + public DotnetToolResource waitFor(IResource dependency) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitFor", reqArgs); + getClient().invokeCapability("Aspire.Hosting/waitFor", reqArgs); + return this; + } + + public DotnetToolResource waitFor(ResourceBuilderBase dependency) { + return waitFor(new IResource(dependency.getHandle(), dependency.getClient())); } /** Waits for another resource with specific behavior */ - public IResourceWithWaitSupport waitForWithBehavior(IResource dependency, WaitBehavior waitBehavior) { + public DotnetToolResource waitForWithBehavior(IResource dependency, WaitBehavior waitBehavior) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("dependency", AspireClient.serializeValue(dependency)); reqArgs.put("waitBehavior", AspireClient.serializeValue(waitBehavior)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForWithBehavior", reqArgs); + getClient().invokeCapability("Aspire.Hosting/waitForWithBehavior", reqArgs); + return this; + } + + public DotnetToolResource waitForWithBehavior(ResourceBuilderBase dependency, WaitBehavior waitBehavior) { + return waitForWithBehavior(new IResource(dependency.getHandle(), dependency.getClient()), waitBehavior); } /** Waits for another resource to start */ - public IResourceWithWaitSupport waitForStart(IResource dependency) { + public DotnetToolResource waitForStart(IResource dependency) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForStart", reqArgs); + getClient().invokeCapability("Aspire.Hosting/waitForStart", reqArgs); + return this; + } + + public DotnetToolResource waitForStart(ResourceBuilderBase dependency) { + return waitForStart(new IResource(dependency.getHandle(), dependency.getClient())); } /** Waits for another resource to start with specific behavior */ - public IResourceWithWaitSupport waitForStartWithBehavior(IResource dependency, WaitBehavior waitBehavior) { + public DotnetToolResource waitForStartWithBehavior(IResource dependency, WaitBehavior waitBehavior) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("dependency", AspireClient.serializeValue(dependency)); reqArgs.put("waitBehavior", AspireClient.serializeValue(waitBehavior)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForStartWithBehavior", reqArgs); + getClient().invokeCapability("Aspire.Hosting/waitForStartWithBehavior", reqArgs); + return this; + } + + public DotnetToolResource waitForStartWithBehavior(ResourceBuilderBase dependency, WaitBehavior waitBehavior) { + return waitForStartWithBehavior(new IResource(dependency.getHandle(), dependency.getClient()), waitBehavior); } /** Prevents resource from starting automatically */ - public IResource withExplicitStart() { + public DotnetToolResource withExplicitStart() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withExplicitStart", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withExplicitStart", reqArgs); + return this; + } + + public DotnetToolResource waitForCompletion(IResource dependency) { + return waitForCompletion(dependency, null); + } + + public DotnetToolResource waitForCompletion(ResourceBuilderBase dependency) { + return waitForCompletion(new IResource(dependency.getHandle(), dependency.getClient())); } /** Waits for resource completion */ - public IResourceWithWaitSupport waitForCompletion(IResource dependency, Double exitCode) { + public DotnetToolResource waitForCompletion(IResource dependency, Double exitCode) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("dependency", AspireClient.serializeValue(dependency)); if (exitCode != null) { reqArgs.put("exitCode", AspireClient.serializeValue(exitCode)); } - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForCompletion", reqArgs); + getClient().invokeCapability("Aspire.Hosting/waitForCompletion", reqArgs); + return this; + } + + public DotnetToolResource waitForCompletion(ResourceBuilderBase dependency, Double exitCode) { + return waitForCompletion(new IResource(dependency.getHandle(), dependency.getClient()), exitCode); } /** Adds a health check by key */ - public IResource withHealthCheck(String key) { + public DotnetToolResource withHealthCheck(String key) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("key", AspireClient.serializeValue(key)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withHealthCheck", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withHealthCheck", reqArgs); + return this; + } + + /** Adds an HTTP health check */ + public DotnetToolResource withHttpHealthCheck(WithHttpHealthCheckOptions options) { + var path = options == null ? null : options.getPath(); + var statusCode = options == null ? null : options.getStatusCode(); + var endpointName = options == null ? null : options.getEndpointName(); + return withHttpHealthCheckImpl(path, statusCode, endpointName); + } + + public DotnetToolResource withHttpHealthCheck() { + return withHttpHealthCheck(null); } /** Adds an HTTP health check */ - public IResourceWithEndpoints withHttpHealthCheck(String path, Double statusCode, String endpointName) { + private DotnetToolResource withHttpHealthCheckImpl(String path, Double statusCode, String endpointName) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); if (path != null) { @@ -1103,86 +6578,135 @@ public IResourceWithEndpoints withHttpHealthCheck(String path, Double statusCode if (endpointName != null) { reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withHttpHealthCheck", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withHttpHealthCheck", reqArgs); + return this; + } + + public DotnetToolResource withCommand(String name, String displayName, AspireFunc1 executeCommand) { + return withCommand(name, displayName, executeCommand, null); } /** Adds a resource command */ - public IResource withCommand(String name, String displayName, Function executeCommand, CommandOptions commandOptions) { + public DotnetToolResource withCommand(String name, String displayName, AspireFunc1 executeCommand, CommandOptions commandOptions) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("name", AspireClient.serializeValue(name)); reqArgs.put("displayName", AspireClient.serializeValue(displayName)); - if (executeCommand != null) { - reqArgs.put("executeCommand", getClient().registerCallback(executeCommand)); + var executeCommandId = getClient().registerCallback(args -> { + var arg = (ExecuteCommandContext) args[0]; + return AspireClient.awaitValue(executeCommand.invoke(arg)); + }); + if (executeCommandId != null) { + reqArgs.put("executeCommand", executeCommandId); } if (commandOptions != null) { reqArgs.put("commandOptions", AspireClient.serializeValue(commandOptions)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withCommand", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withCommand", reqArgs); + return this; } /** Configures developer certificate trust */ - public IResourceWithEnvironment withDeveloperCertificateTrust(boolean trust) { + public DotnetToolResource withDeveloperCertificateTrust(boolean trust) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("trust", AspireClient.serializeValue(trust)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withDeveloperCertificateTrust", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withDeveloperCertificateTrust", reqArgs); + return this; } /** Sets the certificate trust scope */ - public IResourceWithEnvironment withCertificateTrustScope(CertificateTrustScope scope) { + public DotnetToolResource withCertificateTrustScope(CertificateTrustScope scope) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("scope", AspireClient.serializeValue(scope)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withCertificateTrustScope", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withCertificateTrustScope", reqArgs); + return this; + } + + public DotnetToolResource withHttpsDeveloperCertificate() { + return withHttpsDeveloperCertificate(null); } /** Configures HTTPS with a developer certificate */ - public IResourceWithEnvironment withHttpsDeveloperCertificate(ParameterResource password) { + public DotnetToolResource withHttpsDeveloperCertificate(ParameterResource password) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); if (password != null) { reqArgs.put("password", AspireClient.serializeValue(password)); } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withHttpsDeveloperCertificate", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withHttpsDeveloperCertificate", reqArgs); + return this; } /** Removes HTTPS certificate configuration */ - public IResourceWithEnvironment withoutHttpsCertificate() { + public DotnetToolResource withoutHttpsCertificate() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withoutHttpsCertificate", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withoutHttpsCertificate", reqArgs); + return this; } /** Sets the parent relationship */ - public IResource withParentRelationship(IResource parent) { + public DotnetToolResource withParentRelationship(IResource parent) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("parent", AspireClient.serializeValue(parent)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withParentRelationship", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withParentRelationship", reqArgs); + return this; + } + + public DotnetToolResource withParentRelationship(ResourceBuilderBase parent) { + return withParentRelationship(new IResource(parent.getHandle(), parent.getClient())); } /** Sets a child relationship */ - public IResource withChildRelationship(IResource child) { + public DotnetToolResource withChildRelationship(IResource child) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("child", AspireClient.serializeValue(child)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withChildRelationship", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withChildRelationship", reqArgs); + return this; + } + + public DotnetToolResource withChildRelationship(ResourceBuilderBase child) { + return withChildRelationship(new IResource(child.getHandle(), child.getClient())); + } + + public DotnetToolResource withIconName(String iconName) { + return withIconName(iconName, null); } /** Sets the icon for the resource */ - public IResource withIconName(String iconName, IconVariant iconVariant) { + public DotnetToolResource withIconName(String iconName, IconVariant iconVariant) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("iconName", AspireClient.serializeValue(iconName)); if (iconVariant != null) { reqArgs.put("iconVariant", AspireClient.serializeValue(iconVariant)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withIconName", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withIconName", reqArgs); + return this; } /** Adds an HTTP health probe to the resource */ - public IResourceWithEndpoints withHttpProbe(ProbeType probeType, String path, Double initialDelaySeconds, Double periodSeconds, Double timeoutSeconds, Double failureThreshold, Double successThreshold, String endpointName) { + public DotnetToolResource withHttpProbe(ProbeType probeType, WithHttpProbeOptions options) { + var path = options == null ? null : options.getPath(); + var initialDelaySeconds = options == null ? null : options.getInitialDelaySeconds(); + var periodSeconds = options == null ? null : options.getPeriodSeconds(); + var timeoutSeconds = options == null ? null : options.getTimeoutSeconds(); + var failureThreshold = options == null ? null : options.getFailureThreshold(); + var successThreshold = options == null ? null : options.getSuccessThreshold(); + var endpointName = options == null ? null : options.getEndpointName(); + return withHttpProbeImpl(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName); + } + + public DotnetToolResource withHttpProbe(ProbeType probeType) { + return withHttpProbe(probeType, null); + } + + /** Adds an HTTP health probe to the resource */ + private DotnetToolResource withHttpProbeImpl(ProbeType probeType, String path, Double initialDelaySeconds, Double periodSeconds, Double timeoutSeconds, Double failureThreshold, Double successThreshold, String endpointName) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("probeType", AspireClient.serializeValue(probeType)); @@ -1207,39 +6731,61 @@ public IResourceWithEndpoints withHttpProbe(ProbeType probeType, String path, Do if (endpointName != null) { reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withHttpProbe", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withHttpProbe", reqArgs); + return this; } /** Excludes the resource from MCP server exposure */ - public IResource excludeFromMcp() { + public DotnetToolResource excludeFromMcp() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/excludeFromMcp", reqArgs); + getClient().invokeCapability("Aspire.Hosting/excludeFromMcp", reqArgs); + return this; } /** Sets the remote image name for publishing */ - public IComputeResource withRemoteImageName(String remoteImageName) { + public DotnetToolResource withRemoteImageName(String remoteImageName) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("remoteImageName", AspireClient.serializeValue(remoteImageName)); - return (IComputeResource) getClient().invokeCapability("Aspire.Hosting/withRemoteImageName", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withRemoteImageName", reqArgs); + return this; } /** Sets the remote image tag for publishing */ - public IComputeResource withRemoteImageTag(String remoteImageTag) { + public DotnetToolResource withRemoteImageTag(String remoteImageTag) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("remoteImageTag", AspireClient.serializeValue(remoteImageTag)); - return (IComputeResource) getClient().invokeCapability("Aspire.Hosting/withRemoteImageTag", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withRemoteImageTag", reqArgs); + return this; + } + + /** Adds a pipeline step to the resource */ + public DotnetToolResource withPipelineStepFactory(String stepName, AspireAction1 callback, WithPipelineStepFactoryOptions options) { + var dependsOn = options == null ? null : options.getDependsOn(); + var requiredBy = options == null ? null : options.getRequiredBy(); + var tags = options == null ? null : options.getTags(); + var description = options == null ? null : options.getDescription(); + return withPipelineStepFactoryImpl(stepName, callback, dependsOn, requiredBy, tags, description); + } + + public DotnetToolResource withPipelineStepFactory(String stepName, AspireAction1 callback) { + return withPipelineStepFactory(stepName, callback, null); } /** Adds a pipeline step to the resource */ - public IResource withPipelineStepFactory(String stepName, Function callback, String[] dependsOn, String[] requiredBy, String[] tags, String description) { + private DotnetToolResource withPipelineStepFactoryImpl(String stepName, AspireAction1 callback, String[] dependsOn, String[] requiredBy, String[] tags, String description) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("stepName", AspireClient.serializeValue(stepName)); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var arg = (PipelineStepContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } if (dependsOn != null) { reqArgs.put("dependsOn", AspireClient.serializeValue(dependsOn)); @@ -1253,320 +6799,636 @@ public IResource withPipelineStepFactory(String stepName, Function callback) { + public DotnetToolResource withPipelineConfigurationAsync(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (PipelineConfigurationContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withPipelineConfigurationAsync", reqArgs); + return this; + } + + /** Configures pipeline step dependencies via a callback */ + public DotnetToolResource withPipelineConfiguration(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var obj = (PipelineConfigurationContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withPipelineConfiguration", reqArgs); + return this; + } + + /** Gets the resource name */ + public String getResourceName() { + Map reqArgs = new HashMap<>(); + reqArgs.put("resource", AspireClient.serializeValue(getHandle())); + return (String) getClient().invokeCapability("Aspire.Hosting/getResourceName", reqArgs); + } + + /** Subscribes to the BeforeResourceStarted event */ + public DotnetToolResource onBeforeResourceStarted(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (BeforeResourceStartedEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onBeforeResourceStarted", reqArgs); + return this; + } + + /** Subscribes to the ResourceStopped event */ + public DotnetToolResource onResourceStopped(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceStoppedEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onResourceStopped", reqArgs); + return this; + } + + /** Subscribes to the InitializeResource event */ + public DotnetToolResource onInitializeResource(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (InitializeResourceEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onInitializeResource", reqArgs); + return this; + } + + /** Subscribes to the ResourceEndpointsAllocated event */ + public DotnetToolResource onResourceEndpointsAllocated(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceEndpointsAllocatedEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onResourceEndpointsAllocated", reqArgs); + return this; + } + + /** Subscribes to the ResourceReady event */ + public DotnetToolResource onResourceReady(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceReadyEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onResourceReady", reqArgs); + return this; + } + + /** Adds an optional string parameter */ + public DotnetToolResource withOptionalString(WithOptionalStringOptions options) { + var value = options == null ? null : options.getValue(); + var enabled = options == null ? null : options.getEnabled(); + return withOptionalStringImpl(value, enabled); + } + + public DotnetToolResource withOptionalString() { + return withOptionalString(null); + } + + /** Adds an optional string parameter */ + private DotnetToolResource withOptionalStringImpl(String value, Boolean enabled) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + if (value != null) { + reqArgs.put("value", AspireClient.serializeValue(value)); + } + if (enabled != null) { + reqArgs.put("enabled", AspireClient.serializeValue(enabled)); + } + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalString", reqArgs); + return this; + } + + /** Configures the resource with a DTO */ + public DotnetToolResource withConfig(TestConfigDto config) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("config", AspireClient.serializeValue(config)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConfig", reqArgs); + return this; + } + + /** Configures environment with callback (test version) */ + public DotnetToolResource testWithEnvironmentCallback(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (TestEnvironmentContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWithEnvironmentCallback", reqArgs); + return this; + } + + /** Sets the created timestamp */ + public DotnetToolResource withCreatedAt(String createdAt) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("createdAt", AspireClient.serializeValue(createdAt)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCreatedAt", reqArgs); + return this; + } + + /** Sets the modified timestamp */ + public DotnetToolResource withModifiedAt(String modifiedAt) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("modifiedAt", AspireClient.serializeValue(modifiedAt)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withModifiedAt", reqArgs); + return this; + } + + /** Sets the correlation ID */ + public DotnetToolResource withCorrelationId(String correlationId) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("correlationId", AspireClient.serializeValue(correlationId)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCorrelationId", reqArgs); + return this; + } + + public DotnetToolResource withOptionalCallback() { + return withOptionalCallback(null); + } + + /** Configures with optional callback */ + public DotnetToolResource withOptionalCallback(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = callback == null ? null : getClient().registerCallback(args -> { + var arg = (TestCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalCallback", reqArgs); + return this; + } + + /** Sets the resource status */ + public DotnetToolResource withStatus(TestResourceStatus status) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("status", AspireClient.serializeValue(status)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withStatus", reqArgs); + return this; + } + + /** Configures with nested DTO */ + public DotnetToolResource withNestedConfig(TestNestedDto config) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("config", AspireClient.serializeValue(config)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withNestedConfig", reqArgs); + return this; + } + + /** Adds validation callback */ + public DotnetToolResource withValidator(AspireFunc1 validator) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var validatorId = getClient().registerCallback(args -> { + var arg = (TestResourceContext) args[0]; + return AspireClient.awaitValue(validator.invoke(arg)); + }); + if (validatorId != null) { + reqArgs.put("validator", validatorId); + } + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withValidator", reqArgs); + return this; + } + + /** Waits for another resource (test version) */ + public DotnetToolResource testWaitFor(IResource dependency) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWaitFor", reqArgs); + return this; + } + + public DotnetToolResource testWaitFor(ResourceBuilderBase dependency) { + return testWaitFor(new IResource(dependency.getHandle(), dependency.getClient())); + } + + /** Adds a dependency on another resource */ + public DotnetToolResource withDependency(IResourceWithConnectionString dependency) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDependency", reqArgs); + return this; + } + + public DotnetToolResource withDependency(ResourceBuilderBase dependency) { + return withDependency(new IResourceWithConnectionString(dependency.getHandle(), dependency.getClient())); + } + + /** Sets the endpoints */ + public DotnetToolResource withEndpoints(String[] endpoints) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("endpoints", AspireClient.serializeValue(endpoints)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEndpoints", reqArgs); + return this; + } + + /** Sets environment variables */ + public DotnetToolResource withEnvironmentVariables(Map variables) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("variables", AspireClient.serializeValue(variables)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEnvironmentVariables", reqArgs); + return this; + } + + /** Performs a cancellable operation */ + public DotnetToolResource withCancellableOperation(AspireAction1 operation) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var operationId = getClient().registerCallback(args -> { + var arg = CancellationToken.fromValue(args[0]); + operation.invoke(arg); + return null; + }); + if (operationId != null) { + reqArgs.put("operation", operationId); + } + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCancellableOperation", reqArgs); + return this; + } + +} + +// ===== EndpointProperty.java ===== +// EndpointProperty.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** EndpointProperty enum. */ +public enum EndpointProperty implements WireValueEnum { + URL("Url"), + HOST("Host"), + IPV4_HOST("IPV4Host"), + PORT("Port"), + SCHEME("Scheme"), + TARGET_PORT("TargetPort"), + HOST_AND_PORT("HostAndPort"), + TLS_ENABLED("TlsEnabled"); + + private final String value; + + EndpointProperty(String value) { + this.value = value; + } + + public String getValue() { return value; } + + public static EndpointProperty fromValue(String value) { + for (EndpointProperty e : values()) { + if (e.value.equals(value)) return e; } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withPipelineConfigurationAsync", reqArgs); + throw new IllegalArgumentException("Unknown value: " + value); } +} - /** Configures pipeline step dependencies via a callback */ - public IResource withPipelineConfiguration(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withPipelineConfiguration", reqArgs); +// ===== EndpointReference.java ===== +// EndpointReference.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference. */ +public class EndpointReference extends HandleWrapperBase { + EndpointReference(Handle handle, AspireClient client) { + super(handle, client); } - /** Gets the resource name */ - public String getResourceName() { + /** Gets the Resource property */ + public IResourceWithEndpoints resource() { Map reqArgs = new HashMap<>(); - reqArgs.put("resource", AspireClient.serializeValue(getHandle())); - return (String) getClient().invokeCapability("Aspire.Hosting/getResourceName", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReference.resource", reqArgs); } - /** Subscribes to the BeforeResourceStarted event */ - public IResource onBeforeResourceStarted(Function callback) { + /** Gets the EndpointName property */ + public String endpointName() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onBeforeResourceStarted", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (String) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReference.endpointName", reqArgs); } - /** Subscribes to the ResourceStopped event */ - public IResource onResourceStopped(Function callback) { + /** Gets the ErrorMessage property */ + public String errorMessage() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onResourceStopped", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (String) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReference.errorMessage", reqArgs); } - /** Subscribes to the InitializeResource event */ - public IResource onInitializeResource(Function callback) { + /** Sets the ErrorMessage property */ + public EndpointReference setErrorMessage(String value) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onInitializeResource", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + reqArgs.put("value", AspireClient.serializeValue(value)); + return (EndpointReference) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReference.setErrorMessage", reqArgs); } - /** Subscribes to the ResourceEndpointsAllocated event */ - public IResourceWithEndpoints onResourceEndpointsAllocated(Function callback) { + /** Gets the IsAllocated property */ + public boolean isAllocated() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/onResourceEndpointsAllocated", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (boolean) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReference.isAllocated", reqArgs); } - /** Subscribes to the ResourceReady event */ - public IResource onResourceReady(Function callback) { + /** Gets the Exists property */ + public boolean exists() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onResourceReady", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (boolean) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReference.exists", reqArgs); } - /** Adds an optional string parameter */ - public IResource withOptionalString(String value, Boolean enabled) { + /** Gets the IsHttp property */ + public boolean isHttp() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (value != null) { - reqArgs.put("value", AspireClient.serializeValue(value)); - } - if (enabled != null) { - reqArgs.put("enabled", AspireClient.serializeValue(enabled)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalString", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (boolean) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReference.isHttp", reqArgs); } - /** Configures the resource with a DTO */ - public IResource withConfig(TestConfigDto config) { + /** Gets the IsHttps property */ + public boolean isHttps() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("config", AspireClient.serializeValue(config)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConfig", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (boolean) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReference.isHttps", reqArgs); } - /** Configures environment with callback (test version) */ - public IResourceWithEnvironment testWithEnvironmentCallback(Function callback) { + /** Gets the TlsEnabled property */ + public boolean tlsEnabled() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWithEnvironmentCallback", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (boolean) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReference.tlsEnabled", reqArgs); } - /** Sets the created timestamp */ - public IResource withCreatedAt(String createdAt) { + /** Gets the Port property */ + public double port() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("createdAt", AspireClient.serializeValue(createdAt)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCreatedAt", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (double) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReference.port", reqArgs); } - /** Sets the modified timestamp */ - public IResource withModifiedAt(String modifiedAt) { + /** Gets the TargetPort property */ + public double targetPort() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("modifiedAt", AspireClient.serializeValue(modifiedAt)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withModifiedAt", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (double) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReference.targetPort", reqArgs); } - /** Sets the correlation ID */ - public IResource withCorrelationId(String correlationId) { + /** Gets the Host property */ + public String host() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("correlationId", AspireClient.serializeValue(correlationId)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCorrelationId", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (String) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReference.host", reqArgs); } - /** Configures with optional callback */ - public IResource withOptionalCallback(Function callback) { + /** Gets the Scheme property */ + public String scheme() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalCallback", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (String) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReference.scheme", reqArgs); } - /** Sets the resource status */ - public IResource withStatus(TestResourceStatus status) { + /** Gets the Url property */ + public String url() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("status", AspireClient.serializeValue(status)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withStatus", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (String) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReference.url", reqArgs); } - /** Configures with nested DTO */ - public IResource withNestedConfig(TestNestedDto config) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("config", AspireClient.serializeValue(config)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withNestedConfig", reqArgs); + public String getValueAsync() { + return getValueAsync(null); } - /** Adds validation callback */ - public IResource withValidator(Function validator) { + /** Gets the URL of the endpoint asynchronously */ + public String getValueAsync(CancellationToken cancellationToken) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (validator != null) { - reqArgs.put("validator", getClient().registerCallback(validator)); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + if (cancellationToken != null) { + reqArgs.put("cancellationToken", getClient().registerCancellation(cancellationToken)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withValidator", reqArgs); + return (String) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/getValueAsync", reqArgs); } - /** Waits for another resource (test version) */ - public IResource testWaitFor(IResource dependency) { + /** Gets a conditional expression that resolves to the enabledValue when TLS is enabled on the endpoint, or to the disabledValue otherwise. */ + public ReferenceExpression getTlsValue(ReferenceExpression enabledValue, ReferenceExpression disabledValue) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWaitFor", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + reqArgs.put("enabledValue", AspireClient.serializeValue(enabledValue)); + reqArgs.put("disabledValue", AspireClient.serializeValue(disabledValue)); + return (ReferenceExpression) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReference.getTlsValue", reqArgs); } - /** Adds a dependency on another resource */ - public IResource withDependency(IResourceWithConnectionString dependency) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDependency", reqArgs); +} + +// ===== EndpointReferenceExpression.java ===== +// EndpointReferenceExpression.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression. */ +public class EndpointReferenceExpression extends HandleWrapperBase { + EndpointReferenceExpression(Handle handle, AspireClient client) { + super(handle, client); } - /** Sets the endpoints */ - public IResource withEndpoints(String[] endpoints) { + /** Gets the Endpoint property */ + public EndpointReference endpoint() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("endpoints", AspireClient.serializeValue(endpoints)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEndpoints", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (EndpointReference) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.endpoint", reqArgs); } - /** Sets environment variables */ - public IResourceWithEnvironment withEnvironmentVariables(Map variables) { + /** Gets the Property property */ + public EndpointProperty property() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("variables", AspireClient.serializeValue(variables)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEnvironmentVariables", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (EndpointProperty) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.property", reqArgs); } - /** Performs a cancellable operation */ - public IResource withCancellableOperation(Function operation) { + /** Gets the ValueExpression property */ + public String valueExpression() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (operation != null) { - reqArgs.put("operation", getClient().registerCallback(operation)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCancellableOperation", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (String) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.valueExpression", reqArgs); } } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext. */ -class CommandLineArgsCallbackContext extends HandleWrapperBase { - CommandLineArgsCallbackContext(Handle handle, AspireClient client) { +// ===== EnvironmentCallbackContext.java ===== +// EnvironmentCallbackContext.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext. */ +public class EnvironmentCallbackContext extends HandleWrapperBase { + EnvironmentCallbackContext(Handle handle, AspireClient client) { super(handle, client); } - /** Gets the Args property */ - private AspireList argsField; - public AspireList args() { - if (argsField == null) { - argsField = new AspireList<>(getHandle(), getClient(), "Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.args"); + /** Gets the EnvironmentVariables property */ + private AspireDict environmentVariablesField; + public AspireDict environmentVariables() { + if (environmentVariablesField == null) { + environmentVariablesField = new AspireDict<>(getHandle(), getClient(), "Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.environmentVariables"); } - return argsField; + return environmentVariablesField; } /** Gets the CancellationToken property */ public CancellationToken cancellationToken() { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (CancellationToken) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.cancellationToken", reqArgs); + return (CancellationToken) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.cancellationToken", reqArgs); } - /** Gets the ExecutionContext property */ - public DistributedApplicationExecutionContext executionContext() { + /** Gets the Logger property */ + public ILogger logger() { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (DistributedApplicationExecutionContext) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.executionContext", reqArgs); + return (ILogger) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.logger", reqArgs); } - /** Sets the ExecutionContext property */ - public CommandLineArgsCallbackContext setExecutionContext(DistributedApplicationExecutionContext value) { + /** Sets the Logger property */ + public EnvironmentCallbackContext setLogger(ILogger value) { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); reqArgs.put("value", AspireClient.serializeValue(value)); - return (CommandLineArgsCallbackContext) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.setExecutionContext", reqArgs); + return (EnvironmentCallbackContext) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.setLogger", reqArgs); } - /** Gets the Logger property */ - public ILogger logger() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (ILogger) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.logger", reqArgs); + public EnvironmentCallbackContext setLogger(HandleWrapperBase value) { + return setLogger(new ILogger(value.getHandle(), value.getClient())); } - /** Sets the Logger property */ - public CommandLineArgsCallbackContext setLogger(ILogger value) { + /** Gets the Resource property */ + public IResource resource() { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (CommandLineArgsCallbackContext) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.setLogger", reqArgs); + return (IResource) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.resource", reqArgs); } - /** Gets the Resource property */ - public IResource resource() { + /** Gets the ExecutionContext property */ + public DistributedApplicationExecutionContext executionContext() { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/CommandLineArgsCallbackContext.resource", reqArgs); + return (DistributedApplicationExecutionContext) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.executionContext", reqArgs); } } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent. */ -class ConnectionStringAvailableEvent extends HandleWrapperBase { - ConnectionStringAvailableEvent(Handle handle, AspireClient client) { +// ===== ExecutableResource.java ===== +// ExecutableResource.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource. */ +public class ExecutableResource extends ResourceBuilderBase { + ExecutableResource(Handle handle, AspireClient client) { super(handle, client); } - /** Gets the Resource property */ - public IResource resource() { + /** Configures a resource to use a container registry */ + public ExecutableResource withContainerRegistry(IResource registry) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.resource", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("registry", AspireClient.serializeValue(registry)); + getClient().invokeCapability("Aspire.Hosting/withContainerRegistry", reqArgs); + return this; } - /** Gets the Services property */ - public IServiceProvider services() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (IServiceProvider) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ConnectionStringAvailableEvent.services", reqArgs); + public ExecutableResource withContainerRegistry(ResourceBuilderBase registry) { + return withContainerRegistry(new IResource(registry.getHandle(), registry.getClient())); } -} - -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ConnectionStringResource. */ -class ConnectionStringResource extends ResourceBuilderBase { - ConnectionStringResource(Handle handle, AspireClient client) { - super(handle, client); + /** Sets the base image for a Dockerfile build */ + public ExecutableResource withDockerfileBaseImage(WithDockerfileBaseImageOptions options) { + var buildImage = options == null ? null : options.getBuildImage(); + var runtimeImage = options == null ? null : options.getRuntimeImage(); + return withDockerfileBaseImageImpl(buildImage, runtimeImage); } - /** Configures a resource to use a container registry */ - public IResource withContainerRegistry(IResource registry) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("registry", AspireClient.serializeValue(registry)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withContainerRegistry", reqArgs); + public ExecutableResource withDockerfileBaseImage() { + return withDockerfileBaseImage(null); } /** Sets the base image for a Dockerfile build */ - public IResource withDockerfileBaseImage(String buildImage, String runtimeImage) { + private ExecutableResource withDockerfileBaseImageImpl(String buildImage, String runtimeImage) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); if (buildImage != null) { @@ -1575,1537 +7437,1606 @@ public IResource withDockerfileBaseImage(String buildImage, String runtimeImage) if (runtimeImage != null) { reqArgs.put("runtimeImage", AspireClient.serializeValue(runtimeImage)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withDockerfileBaseImage", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withDockerfileBaseImage", reqArgs); + return this; } - /** Adds a required command dependency */ - public IResource withRequiredCommand(String command, String helpLink) { + /** Publishes the executable as a Docker container */ + public ExecutableResource publishAsDockerFile() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("command", AspireClient.serializeValue(command)); - if (helpLink != null) { - reqArgs.put("helpLink", AspireClient.serializeValue(helpLink)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withRequiredCommand", reqArgs); + getClient().invokeCapability("Aspire.Hosting/publishAsDockerFile", reqArgs); + return this; } - /** Adds a connection property with a reference expression */ - public IResourceWithConnectionString withConnectionProperty(String name, ReferenceExpression value) { + /** Publishes an executable as a Docker file with optional container configuration */ + public ExecutableResource publishAsDockerFileWithConfigure(AspireAction1 configure) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (IResourceWithConnectionString) getClient().invokeCapability("Aspire.Hosting/withConnectionProperty", reqArgs); + var configureId = getClient().registerCallback(args -> { + var obj = (ContainerResource) args[0]; + configure.invoke(obj); + return null; + }); + if (configureId != null) { + reqArgs.put("configure", configureId); + } + getClient().invokeCapability("Aspire.Hosting/publishAsDockerFileWithConfigure", reqArgs); + return this; } - /** Adds a connection property with a string value */ - public IResourceWithConnectionString withConnectionPropertyValue(String name, String value) { + /** Sets the executable command */ + public ExecutableResource withExecutableCommand(String command) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (IResourceWithConnectionString) getClient().invokeCapability("Aspire.Hosting/withConnectionPropertyValue", reqArgs); + reqArgs.put("command", AspireClient.serializeValue(command)); + getClient().invokeCapability("Aspire.Hosting/withExecutableCommand", reqArgs); + return this; } - /** Customizes displayed URLs via callback */ - public IResource withUrlsCallback(Function callback) { + /** Sets the executable working directory */ + public ExecutableResource withWorkingDirectory(String workingDirectory) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlsCallback", reqArgs); + reqArgs.put("workingDirectory", AspireClient.serializeValue(workingDirectory)); + getClient().invokeCapability("Aspire.Hosting/withWorkingDirectory", reqArgs); + return this; } - /** Customizes displayed URLs via async callback */ - public IResource withUrlsCallbackAsync(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlsCallbackAsync", reqArgs); + /** Configures an MCP server endpoint on the resource */ + public ExecutableResource withMcpServer(WithMcpServerOptions options) { + var path = options == null ? null : options.getPath(); + var endpointName = options == null ? null : options.getEndpointName(); + return withMcpServerImpl(path, endpointName); } - /** Adds or modifies displayed URLs */ - public IResource withUrl(String url, String displayText) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("url", AspireClient.serializeValue(url)); - if (displayText != null) { - reqArgs.put("displayText", AspireClient.serializeValue(displayText)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrl", reqArgs); + public ExecutableResource withMcpServer() { + return withMcpServer(null); } - /** Adds a URL using a reference expression */ - public IResource withUrlExpression(ReferenceExpression url, String displayText) { + /** Configures an MCP server endpoint on the resource */ + private ExecutableResource withMcpServerImpl(String path, String endpointName) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("url", AspireClient.serializeValue(url)); - if (displayText != null) { - reqArgs.put("displayText", AspireClient.serializeValue(displayText)); + if (path != null) { + reqArgs.put("path", AspireClient.serializeValue(path)); + } + if (endpointName != null) { + reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlExpression", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withMcpServer", reqArgs); + return this; } - /** Customizes the URL for a specific endpoint via callback */ - public IResource withUrlForEndpoint(String endpointName, Function callback) { + /** Configures OTLP telemetry export */ + public ExecutableResource withOtlpExporter() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlForEndpoint", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withOtlpExporter", reqArgs); + return this; } - /** Excludes the resource from the deployment manifest */ - public IResource excludeFromManifest() { + /** Configures OTLP telemetry export with specific protocol */ + public ExecutableResource withOtlpExporterProtocol(OtlpProtocol protocol) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/excludeFromManifest", reqArgs); + reqArgs.put("protocol", AspireClient.serializeValue(protocol)); + getClient().invokeCapability("Aspire.Hosting/withOtlpExporterProtocol", reqArgs); + return this; } - /** Waits for another resource to be ready */ - public IResourceWithWaitSupport waitFor(IResource dependency) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitFor", reqArgs); + public ExecutableResource withRequiredCommand(String command) { + return withRequiredCommand(command, null); } - /** Waits for another resource with specific behavior */ - public IResourceWithWaitSupport waitForWithBehavior(IResource dependency, WaitBehavior waitBehavior) { + /** Adds a required command dependency */ + public ExecutableResource withRequiredCommand(String command, String helpLink) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - reqArgs.put("waitBehavior", AspireClient.serializeValue(waitBehavior)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForWithBehavior", reqArgs); + reqArgs.put("command", AspireClient.serializeValue(command)); + if (helpLink != null) { + reqArgs.put("helpLink", AspireClient.serializeValue(helpLink)); + } + getClient().invokeCapability("Aspire.Hosting/withRequiredCommand", reqArgs); + return this; } - /** Waits for another resource to start */ - public IResourceWithWaitSupport waitForStart(IResource dependency) { + /** Sets an environment variable */ + public ExecutableResource withEnvironment(String name, String value) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForStart", reqArgs); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("value", AspireClient.serializeValue(value)); + getClient().invokeCapability("Aspire.Hosting/withEnvironment", reqArgs); + return this; } - /** Waits for another resource to start with specific behavior */ - public IResourceWithWaitSupport waitForStartWithBehavior(IResource dependency, WaitBehavior waitBehavior) { + /** Adds an environment variable with a reference expression */ + public ExecutableResource withEnvironmentExpression(String name, ReferenceExpression value) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - reqArgs.put("waitBehavior", AspireClient.serializeValue(waitBehavior)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForStartWithBehavior", reqArgs); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("value", AspireClient.serializeValue(value)); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentExpression", reqArgs); + return this; } - /** Prevents resource from starting automatically */ - public IResource withExplicitStart() { + /** Sets environment variables via callback */ + public ExecutableResource withEnvironmentCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withExplicitStart", reqArgs); + var callbackId = getClient().registerCallback(args -> { + var obj = (EnvironmentCallbackContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withEnvironmentCallback", reqArgs); + return this; } - /** Waits for resource completion */ - public IResourceWithWaitSupport waitForCompletion(IResource dependency, Double exitCode) { + /** Sets environment variables via async callback */ + public ExecutableResource withEnvironmentCallbackAsync(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - if (exitCode != null) { - reqArgs.put("exitCode", AspireClient.serializeValue(exitCode)); + var callbackId = getClient().registerCallback(args -> { + var arg = (EnvironmentCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForCompletion", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentCallbackAsync", reqArgs); + return this; } - /** Adds a health check by key */ - public IResource withHealthCheck(String key) { + /** Sets an environment variable from an endpoint reference */ + public ExecutableResource withEnvironmentEndpoint(String name, EndpointReference endpointReference) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("key", AspireClient.serializeValue(key)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withHealthCheck", reqArgs); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("endpointReference", AspireClient.serializeValue(endpointReference)); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentEndpoint", reqArgs); + return this; } - /** Adds a resource command */ - public IResource withCommand(String name, String displayName, Function executeCommand, CommandOptions commandOptions) { + /** Sets an environment variable from a parameter resource */ + public ExecutableResource withEnvironmentParameter(String name, ParameterResource parameter) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("displayName", AspireClient.serializeValue(displayName)); - if (executeCommand != null) { - reqArgs.put("executeCommand", getClient().registerCallback(executeCommand)); - } - if (commandOptions != null) { - reqArgs.put("commandOptions", AspireClient.serializeValue(commandOptions)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withCommand", reqArgs); + reqArgs.put("parameter", AspireClient.serializeValue(parameter)); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentParameter", reqArgs); + return this; } - /** Sets the parent relationship */ - public IResource withParentRelationship(IResource parent) { + /** Sets an environment variable from a connection string resource */ + public ExecutableResource withEnvironmentConnectionString(String envVarName, IResourceWithConnectionString resource) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("parent", AspireClient.serializeValue(parent)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withParentRelationship", reqArgs); + reqArgs.put("envVarName", AspireClient.serializeValue(envVarName)); + reqArgs.put("resource", AspireClient.serializeValue(resource)); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentConnectionString", reqArgs); + return this; } - /** Sets a child relationship */ - public IResource withChildRelationship(IResource child) { + public ExecutableResource withEnvironmentConnectionString(String envVarName, ResourceBuilderBase resource) { + return withEnvironmentConnectionString(envVarName, new IResourceWithConnectionString(resource.getHandle(), resource.getClient())); + } + + /** Adds arguments */ + public ExecutableResource withArgs(String[] args) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("child", AspireClient.serializeValue(child)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withChildRelationship", reqArgs); + reqArgs.put("args", AspireClient.serializeValue(args)); + getClient().invokeCapability("Aspire.Hosting/withArgs", reqArgs); + return this; } - /** Sets the icon for the resource */ - public IResource withIconName(String iconName, IconVariant iconVariant) { + /** Sets command-line arguments via callback */ + public ExecutableResource withArgsCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("iconName", AspireClient.serializeValue(iconName)); - if (iconVariant != null) { - reqArgs.put("iconVariant", AspireClient.serializeValue(iconVariant)); + var callbackId = getClient().registerCallback(args -> { + var obj = (CommandLineArgsCallbackContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withIconName", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withArgsCallback", reqArgs); + return this; } - /** Excludes the resource from MCP server exposure */ - public IResource excludeFromMcp() { + /** Sets command-line arguments via async callback */ + public ExecutableResource withArgsCallbackAsync(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/excludeFromMcp", reqArgs); + var callbackId = getClient().registerCallback(args -> { + var arg = (CommandLineArgsCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withArgsCallbackAsync", reqArgs); + return this; } - /** Adds a pipeline step to the resource */ - public IResource withPipelineStepFactory(String stepName, Function callback, String[] dependsOn, String[] requiredBy, String[] tags, String description) { + /** Adds a reference to another resource */ + public ExecutableResource withReference(IResource source, WithReferenceOptions options) { + var connectionName = options == null ? null : options.getConnectionName(); + var optional = options == null ? null : options.getOptional(); + var name = options == null ? null : options.getName(); + return withReferenceImpl(source, connectionName, optional, name); + } + + public ExecutableResource withReference(ResourceBuilderBase source, WithReferenceOptions options) { + return withReference(new IResource(source.getHandle(), source.getClient()), options); + } + + public ExecutableResource withReference(IResource source) { + return withReference(source, null); + } + + public ExecutableResource withReference(ResourceBuilderBase source) { + return withReference(new IResource(source.getHandle(), source.getClient())); + } + + /** Adds a reference to another resource */ + private ExecutableResource withReferenceImpl(IResource source, String connectionName, Boolean optional, String name) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("stepName", AspireClient.serializeValue(stepName)); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - if (dependsOn != null) { - reqArgs.put("dependsOn", AspireClient.serializeValue(dependsOn)); - } - if (requiredBy != null) { - reqArgs.put("requiredBy", AspireClient.serializeValue(requiredBy)); + reqArgs.put("source", AspireClient.serializeValue(source)); + if (connectionName != null) { + reqArgs.put("connectionName", AspireClient.serializeValue(connectionName)); } - if (tags != null) { - reqArgs.put("tags", AspireClient.serializeValue(tags)); + if (optional != null) { + reqArgs.put("optional", AspireClient.serializeValue(optional)); } - if (description != null) { - reqArgs.put("description", AspireClient.serializeValue(description)); + if (name != null) { + reqArgs.put("name", AspireClient.serializeValue(name)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withPipelineStepFactory", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withReference", reqArgs); + return this; } - /** Configures pipeline step dependencies via an async callback */ - public IResource withPipelineConfigurationAsync(Function callback) { + /** Adds a reference to a URI */ + public ExecutableResource withReferenceUri(String name, String uri) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withPipelineConfigurationAsync", reqArgs); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("uri", AspireClient.serializeValue(uri)); + getClient().invokeCapability("Aspire.Hosting/withReferenceUri", reqArgs); + return this; } - /** Configures pipeline step dependencies via a callback */ - public IResource withPipelineConfiguration(Function callback) { + /** Adds a reference to an external service */ + public ExecutableResource withReferenceExternalService(ExternalServiceResource externalService) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withPipelineConfiguration", reqArgs); + reqArgs.put("externalService", AspireClient.serializeValue(externalService)); + getClient().invokeCapability("Aspire.Hosting/withReferenceExternalService", reqArgs); + return this; } - /** Gets the resource name */ - public String getResourceName() { + /** Adds a reference to an endpoint */ + public ExecutableResource withReferenceEndpoint(EndpointReference endpointReference) { Map reqArgs = new HashMap<>(); - reqArgs.put("resource", AspireClient.serializeValue(getHandle())); - return (String) getClient().invokeCapability("Aspire.Hosting/getResourceName", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("endpointReference", AspireClient.serializeValue(endpointReference)); + getClient().invokeCapability("Aspire.Hosting/withReferenceEndpoint", reqArgs); + return this; } - /** Subscribes to the BeforeResourceStarted event */ - public IResource onBeforeResourceStarted(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onBeforeResourceStarted", reqArgs); + /** Adds a network endpoint */ + public ExecutableResource withEndpoint(WithEndpointOptions options) { + var port = options == null ? null : options.getPort(); + var targetPort = options == null ? null : options.getTargetPort(); + var scheme = options == null ? null : options.getScheme(); + var name = options == null ? null : options.getName(); + var env = options == null ? null : options.getEnv(); + var isProxied = options == null ? null : options.isProxied(); + var isExternal = options == null ? null : options.isExternal(); + var protocol = options == null ? null : options.getProtocol(); + return withEndpointImpl(port, targetPort, scheme, name, env, isProxied, isExternal, protocol); } - /** Subscribes to the ResourceStopped event */ - public IResource onResourceStopped(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onResourceStopped", reqArgs); + public ExecutableResource withEndpoint() { + return withEndpoint(null); } - /** Subscribes to the ConnectionStringAvailable event */ - public IResourceWithConnectionString onConnectionStringAvailable(Function callback) { + /** Adds a network endpoint */ + private ExecutableResource withEndpointImpl(Double port, Double targetPort, String scheme, String name, String env, Boolean isProxied, Boolean isExternal, ProtocolType protocol) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + if (port != null) { + reqArgs.put("port", AspireClient.serializeValue(port)); + } + if (targetPort != null) { + reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); + } + if (scheme != null) { + reqArgs.put("scheme", AspireClient.serializeValue(scheme)); + } + if (name != null) { + reqArgs.put("name", AspireClient.serializeValue(name)); + } + if (env != null) { + reqArgs.put("env", AspireClient.serializeValue(env)); + } + if (isProxied != null) { + reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); + } + if (isExternal != null) { + reqArgs.put("isExternal", AspireClient.serializeValue(isExternal)); } - return (IResourceWithConnectionString) getClient().invokeCapability("Aspire.Hosting/onConnectionStringAvailable", reqArgs); + if (protocol != null) { + reqArgs.put("protocol", AspireClient.serializeValue(protocol)); + } + getClient().invokeCapability("Aspire.Hosting/withEndpoint", reqArgs); + return this; } - /** Subscribes to the InitializeResource event */ - public IResource onInitializeResource(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onInitializeResource", reqArgs); + /** Adds an HTTP endpoint */ + public ExecutableResource withHttpEndpoint(WithHttpEndpointOptions options) { + var port = options == null ? null : options.getPort(); + var targetPort = options == null ? null : options.getTargetPort(); + var name = options == null ? null : options.getName(); + var env = options == null ? null : options.getEnv(); + var isProxied = options == null ? null : options.isProxied(); + return withHttpEndpointImpl(port, targetPort, name, env, isProxied); } - /** Subscribes to the ResourceReady event */ - public IResource onResourceReady(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onResourceReady", reqArgs); + public ExecutableResource withHttpEndpoint() { + return withHttpEndpoint(null); } - /** Adds an optional string parameter */ - public IResource withOptionalString(String value, Boolean enabled) { + /** Adds an HTTP endpoint */ + private ExecutableResource withHttpEndpointImpl(Double port, Double targetPort, String name, String env, Boolean isProxied) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (value != null) { - reqArgs.put("value", AspireClient.serializeValue(value)); + if (port != null) { + reqArgs.put("port", AspireClient.serializeValue(port)); } - if (enabled != null) { - reqArgs.put("enabled", AspireClient.serializeValue(enabled)); + if (targetPort != null) { + reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); + } + if (name != null) { + reqArgs.put("name", AspireClient.serializeValue(name)); + } + if (env != null) { + reqArgs.put("env", AspireClient.serializeValue(env)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalString", reqArgs); + if (isProxied != null) { + reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); + } + getClient().invokeCapability("Aspire.Hosting/withHttpEndpoint", reqArgs); + return this; } - /** Configures the resource with a DTO */ - public IResource withConfig(TestConfigDto config) { + /** Adds an HTTPS endpoint */ + public ExecutableResource withHttpsEndpoint(WithHttpsEndpointOptions options) { + var port = options == null ? null : options.getPort(); + var targetPort = options == null ? null : options.getTargetPort(); + var name = options == null ? null : options.getName(); + var env = options == null ? null : options.getEnv(); + var isProxied = options == null ? null : options.isProxied(); + return withHttpsEndpointImpl(port, targetPort, name, env, isProxied); + } + + public ExecutableResource withHttpsEndpoint() { + return withHttpsEndpoint(null); + } + + /** Adds an HTTPS endpoint */ + private ExecutableResource withHttpsEndpointImpl(Double port, Double targetPort, String name, String env, Boolean isProxied) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("config", AspireClient.serializeValue(config)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConfig", reqArgs); + if (port != null) { + reqArgs.put("port", AspireClient.serializeValue(port)); + } + if (targetPort != null) { + reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); + } + if (name != null) { + reqArgs.put("name", AspireClient.serializeValue(name)); + } + if (env != null) { + reqArgs.put("env", AspireClient.serializeValue(env)); + } + if (isProxied != null) { + reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); + } + getClient().invokeCapability("Aspire.Hosting/withHttpsEndpoint", reqArgs); + return this; } - /** Sets the connection string using a reference expression */ - public IResourceWithConnectionString withConnectionString(ReferenceExpression connectionString) { + /** Makes HTTP endpoints externally accessible */ + public ExecutableResource withExternalHttpEndpoints() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("connectionString", AspireClient.serializeValue(connectionString)); - return (IResourceWithConnectionString) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConnectionString", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withExternalHttpEndpoints", reqArgs); + return this; } - /** Sets the created timestamp */ - public IResource withCreatedAt(String createdAt) { + /** Gets an endpoint reference */ + public EndpointReference getEndpoint(String name) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("createdAt", AspireClient.serializeValue(createdAt)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCreatedAt", reqArgs); + reqArgs.put("name", AspireClient.serializeValue(name)); + return (EndpointReference) getClient().invokeCapability("Aspire.Hosting/getEndpoint", reqArgs); } - /** Sets the modified timestamp */ - public IResource withModifiedAt(String modifiedAt) { + /** Configures resource for HTTP/2 */ + public ExecutableResource asHttp2Service() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("modifiedAt", AspireClient.serializeValue(modifiedAt)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withModifiedAt", reqArgs); + getClient().invokeCapability("Aspire.Hosting/asHttp2Service", reqArgs); + return this; } - /** Sets the correlation ID */ - public IResource withCorrelationId(String correlationId) { + /** Customizes displayed URLs via callback */ + public ExecutableResource withUrlsCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("correlationId", AspireClient.serializeValue(correlationId)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCorrelationId", reqArgs); + var callbackId = getClient().registerCallback(args -> { + var obj = (ResourceUrlsCallbackContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withUrlsCallback", reqArgs); + return this; } - /** Configures with optional callback */ - public IResource withOptionalCallback(Function callback) { + /** Customizes displayed URLs via async callback */ + public ExecutableResource withUrlsCallbackAsync(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceUrlsCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalCallback", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrlsCallbackAsync", reqArgs); + return this; } - /** Sets the resource status */ - public IResource withStatus(TestResourceStatus status) { + public ExecutableResource withUrl(String url) { + return withUrl(url, null); + } + + /** Adds or modifies displayed URLs */ + public ExecutableResource withUrl(String url, String displayText) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("status", AspireClient.serializeValue(status)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withStatus", reqArgs); + reqArgs.put("url", AspireClient.serializeValue(url)); + if (displayText != null) { + reqArgs.put("displayText", AspireClient.serializeValue(displayText)); + } + getClient().invokeCapability("Aspire.Hosting/withUrl", reqArgs); + return this; } - /** Configures with nested DTO */ - public IResource withNestedConfig(TestNestedDto config) { + public ExecutableResource withUrlExpression(ReferenceExpression url) { + return withUrlExpression(url, null); + } + + /** Adds a URL using a reference expression */ + public ExecutableResource withUrlExpression(ReferenceExpression url, String displayText) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("config", AspireClient.serializeValue(config)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withNestedConfig", reqArgs); + reqArgs.put("url", AspireClient.serializeValue(url)); + if (displayText != null) { + reqArgs.put("displayText", AspireClient.serializeValue(displayText)); + } + getClient().invokeCapability("Aspire.Hosting/withUrlExpression", reqArgs); + return this; } - /** Adds validation callback */ - public IResource withValidator(Function validator) { + /** Customizes the URL for a specific endpoint via callback */ + public ExecutableResource withUrlForEndpoint(String endpointName, AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (validator != null) { - reqArgs.put("validator", getClient().registerCallback(validator)); + reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + var callbackId = getClient().registerCallback(args -> { + var obj = (ResourceUrlAnnotation) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withValidator", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrlForEndpoint", reqArgs); + return this; } - /** Waits for another resource (test version) */ - public IResource testWaitFor(IResource dependency) { + /** Adds a URL for a specific endpoint via factory callback */ + public ExecutableResource withUrlForEndpointFactory(String endpointName, AspireFunc1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWaitFor", reqArgs); + reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + var callbackId = getClient().registerCallback(args -> { + var arg = (EndpointReference) args[0]; + return AspireClient.awaitValue(callback.invoke(arg)); + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withUrlForEndpointFactory", reqArgs); + return this; } - /** Sets connection string using direct interface target */ - public IResourceWithConnectionString withConnectionStringDirect(String connectionString) { + /** Excludes the resource from the deployment manifest */ + public ExecutableResource excludeFromManifest() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("connectionString", AspireClient.serializeValue(connectionString)); - return (IResourceWithConnectionString) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConnectionStringDirect", reqArgs); + getClient().invokeCapability("Aspire.Hosting/excludeFromManifest", reqArgs); + return this; } - /** Adds a dependency on another resource */ - public IResource withDependency(IResourceWithConnectionString dependency) { + /** Waits for another resource to be ready */ + public ExecutableResource waitFor(IResource dependency) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDependency", reqArgs); + getClient().invokeCapability("Aspire.Hosting/waitFor", reqArgs); + return this; } - /** Sets the endpoints */ - public IResource withEndpoints(String[] endpoints) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("endpoints", AspireClient.serializeValue(endpoints)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEndpoints", reqArgs); + public ExecutableResource waitFor(ResourceBuilderBase dependency) { + return waitFor(new IResource(dependency.getHandle(), dependency.getClient())); } - /** Performs a cancellable operation */ - public IResource withCancellableOperation(Function operation) { + /** Waits for another resource with specific behavior */ + public ExecutableResource waitForWithBehavior(IResource dependency, WaitBehavior waitBehavior) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (operation != null) { - reqArgs.put("operation", getClient().registerCallback(operation)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCancellableOperation", reqArgs); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + reqArgs.put("waitBehavior", AspireClient.serializeValue(waitBehavior)); + getClient().invokeCapability("Aspire.Hosting/waitForWithBehavior", reqArgs); + return this; } -} - -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource. */ -class ContainerRegistryResource extends ResourceBuilderBase { - ContainerRegistryResource(Handle handle, AspireClient client) { - super(handle, client); + public ExecutableResource waitForWithBehavior(ResourceBuilderBase dependency, WaitBehavior waitBehavior) { + return waitForWithBehavior(new IResource(dependency.getHandle(), dependency.getClient()), waitBehavior); } - /** Configures a resource to use a container registry */ - public IResource withContainerRegistry(IResource registry) { + /** Waits for another resource to start */ + public ExecutableResource waitForStart(IResource dependency) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("registry", AspireClient.serializeValue(registry)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withContainerRegistry", reqArgs); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + getClient().invokeCapability("Aspire.Hosting/waitForStart", reqArgs); + return this; } - /** Sets the base image for a Dockerfile build */ - public IResource withDockerfileBaseImage(String buildImage, String runtimeImage) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (buildImage != null) { - reqArgs.put("buildImage", AspireClient.serializeValue(buildImage)); - } - if (runtimeImage != null) { - reqArgs.put("runtimeImage", AspireClient.serializeValue(runtimeImage)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withDockerfileBaseImage", reqArgs); + public ExecutableResource waitForStart(ResourceBuilderBase dependency) { + return waitForStart(new IResource(dependency.getHandle(), dependency.getClient())); } - /** Adds a required command dependency */ - public IResource withRequiredCommand(String command, String helpLink) { + /** Waits for another resource to start with specific behavior */ + public ExecutableResource waitForStartWithBehavior(IResource dependency, WaitBehavior waitBehavior) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("command", AspireClient.serializeValue(command)); - if (helpLink != null) { - reqArgs.put("helpLink", AspireClient.serializeValue(helpLink)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withRequiredCommand", reqArgs); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + reqArgs.put("waitBehavior", AspireClient.serializeValue(waitBehavior)); + getClient().invokeCapability("Aspire.Hosting/waitForStartWithBehavior", reqArgs); + return this; } - /** Customizes displayed URLs via callback */ - public IResource withUrlsCallback(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlsCallback", reqArgs); + public ExecutableResource waitForStartWithBehavior(ResourceBuilderBase dependency, WaitBehavior waitBehavior) { + return waitForStartWithBehavior(new IResource(dependency.getHandle(), dependency.getClient()), waitBehavior); } - /** Customizes displayed URLs via async callback */ - public IResource withUrlsCallbackAsync(Function callback) { + /** Prevents resource from starting automatically */ + public ExecutableResource withExplicitStart() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlsCallbackAsync", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withExplicitStart", reqArgs); + return this; } - /** Adds or modifies displayed URLs */ - public IResource withUrl(String url, String displayText) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("url", AspireClient.serializeValue(url)); - if (displayText != null) { - reqArgs.put("displayText", AspireClient.serializeValue(displayText)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrl", reqArgs); + public ExecutableResource waitForCompletion(IResource dependency) { + return waitForCompletion(dependency, null); } - /** Adds a URL using a reference expression */ - public IResource withUrlExpression(ReferenceExpression url, String displayText) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("url", AspireClient.serializeValue(url)); - if (displayText != null) { - reqArgs.put("displayText", AspireClient.serializeValue(displayText)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlExpression", reqArgs); + public ExecutableResource waitForCompletion(ResourceBuilderBase dependency) { + return waitForCompletion(new IResource(dependency.getHandle(), dependency.getClient())); } - /** Customizes the URL for a specific endpoint via callback */ - public IResource withUrlForEndpoint(String endpointName, Function callback) { + /** Waits for resource completion */ + public ExecutableResource waitForCompletion(IResource dependency, Double exitCode) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + if (exitCode != null) { + reqArgs.put("exitCode", AspireClient.serializeValue(exitCode)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlForEndpoint", reqArgs); + getClient().invokeCapability("Aspire.Hosting/waitForCompletion", reqArgs); + return this; } - /** Excludes the resource from the deployment manifest */ - public IResource excludeFromManifest() { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/excludeFromManifest", reqArgs); + public ExecutableResource waitForCompletion(ResourceBuilderBase dependency, Double exitCode) { + return waitForCompletion(new IResource(dependency.getHandle(), dependency.getClient()), exitCode); } - /** Prevents resource from starting automatically */ - public IResource withExplicitStart() { + /** Adds a health check by key */ + public ExecutableResource withHealthCheck(String key) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withExplicitStart", reqArgs); + reqArgs.put("key", AspireClient.serializeValue(key)); + getClient().invokeCapability("Aspire.Hosting/withHealthCheck", reqArgs); + return this; } - /** Adds a health check by key */ - public IResource withHealthCheck(String key) { + /** Adds an HTTP health check */ + public ExecutableResource withHttpHealthCheck(WithHttpHealthCheckOptions options) { + var path = options == null ? null : options.getPath(); + var statusCode = options == null ? null : options.getStatusCode(); + var endpointName = options == null ? null : options.getEndpointName(); + return withHttpHealthCheckImpl(path, statusCode, endpointName); + } + + public ExecutableResource withHttpHealthCheck() { + return withHttpHealthCheck(null); + } + + /** Adds an HTTP health check */ + private ExecutableResource withHttpHealthCheckImpl(String path, Double statusCode, String endpointName) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("key", AspireClient.serializeValue(key)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withHealthCheck", reqArgs); + if (path != null) { + reqArgs.put("path", AspireClient.serializeValue(path)); + } + if (statusCode != null) { + reqArgs.put("statusCode", AspireClient.serializeValue(statusCode)); + } + if (endpointName != null) { + reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + } + getClient().invokeCapability("Aspire.Hosting/withHttpHealthCheck", reqArgs); + return this; + } + + public ExecutableResource withCommand(String name, String displayName, AspireFunc1 executeCommand) { + return withCommand(name, displayName, executeCommand, null); } /** Adds a resource command */ - public IResource withCommand(String name, String displayName, Function executeCommand, CommandOptions commandOptions) { + public ExecutableResource withCommand(String name, String displayName, AspireFunc1 executeCommand, CommandOptions commandOptions) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("name", AspireClient.serializeValue(name)); reqArgs.put("displayName", AspireClient.serializeValue(displayName)); - if (executeCommand != null) { - reqArgs.put("executeCommand", getClient().registerCallback(executeCommand)); + var executeCommandId = getClient().registerCallback(args -> { + var arg = (ExecuteCommandContext) args[0]; + return AspireClient.awaitValue(executeCommand.invoke(arg)); + }); + if (executeCommandId != null) { + reqArgs.put("executeCommand", executeCommandId); } if (commandOptions != null) { reqArgs.put("commandOptions", AspireClient.serializeValue(commandOptions)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withCommand", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withCommand", reqArgs); + return this; } - /** Sets the parent relationship */ - public IResource withParentRelationship(IResource parent) { + /** Configures developer certificate trust */ + public ExecutableResource withDeveloperCertificateTrust(boolean trust) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("parent", AspireClient.serializeValue(parent)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withParentRelationship", reqArgs); + reqArgs.put("trust", AspireClient.serializeValue(trust)); + getClient().invokeCapability("Aspire.Hosting/withDeveloperCertificateTrust", reqArgs); + return this; } - /** Sets a child relationship */ - public IResource withChildRelationship(IResource child) { + /** Sets the certificate trust scope */ + public ExecutableResource withCertificateTrustScope(CertificateTrustScope scope) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("child", AspireClient.serializeValue(child)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withChildRelationship", reqArgs); + reqArgs.put("scope", AspireClient.serializeValue(scope)); + getClient().invokeCapability("Aspire.Hosting/withCertificateTrustScope", reqArgs); + return this; } - /** Sets the icon for the resource */ - public IResource withIconName(String iconName, IconVariant iconVariant) { + public ExecutableResource withHttpsDeveloperCertificate() { + return withHttpsDeveloperCertificate(null); + } + + /** Configures HTTPS with a developer certificate */ + public ExecutableResource withHttpsDeveloperCertificate(ParameterResource password) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("iconName", AspireClient.serializeValue(iconName)); - if (iconVariant != null) { - reqArgs.put("iconVariant", AspireClient.serializeValue(iconVariant)); + if (password != null) { + reqArgs.put("password", AspireClient.serializeValue(password)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withIconName", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withHttpsDeveloperCertificate", reqArgs); + return this; } - /** Excludes the resource from MCP server exposure */ - public IResource excludeFromMcp() { + /** Removes HTTPS certificate configuration */ + public ExecutableResource withoutHttpsCertificate() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/excludeFromMcp", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withoutHttpsCertificate", reqArgs); + return this; } - /** Adds a pipeline step to the resource */ - public IResource withPipelineStepFactory(String stepName, Function callback, String[] dependsOn, String[] requiredBy, String[] tags, String description) { + /** Sets the parent relationship */ + public ExecutableResource withParentRelationship(IResource parent) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("stepName", AspireClient.serializeValue(stepName)); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - if (dependsOn != null) { - reqArgs.put("dependsOn", AspireClient.serializeValue(dependsOn)); - } - if (requiredBy != null) { - reqArgs.put("requiredBy", AspireClient.serializeValue(requiredBy)); - } - if (tags != null) { - reqArgs.put("tags", AspireClient.serializeValue(tags)); - } - if (description != null) { - reqArgs.put("description", AspireClient.serializeValue(description)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withPipelineStepFactory", reqArgs); + reqArgs.put("parent", AspireClient.serializeValue(parent)); + getClient().invokeCapability("Aspire.Hosting/withParentRelationship", reqArgs); + return this; } - /** Configures pipeline step dependencies via an async callback */ - public IResource withPipelineConfigurationAsync(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withPipelineConfigurationAsync", reqArgs); + public ExecutableResource withParentRelationship(ResourceBuilderBase parent) { + return withParentRelationship(new IResource(parent.getHandle(), parent.getClient())); } - /** Configures pipeline step dependencies via a callback */ - public IResource withPipelineConfiguration(Function callback) { + /** Sets a child relationship */ + public ExecutableResource withChildRelationship(IResource child) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withPipelineConfiguration", reqArgs); + reqArgs.put("child", AspireClient.serializeValue(child)); + getClient().invokeCapability("Aspire.Hosting/withChildRelationship", reqArgs); + return this; } - /** Gets the resource name */ - public String getResourceName() { - Map reqArgs = new HashMap<>(); - reqArgs.put("resource", AspireClient.serializeValue(getHandle())); - return (String) getClient().invokeCapability("Aspire.Hosting/getResourceName", reqArgs); + public ExecutableResource withChildRelationship(ResourceBuilderBase child) { + return withChildRelationship(new IResource(child.getHandle(), child.getClient())); } - /** Subscribes to the BeforeResourceStarted event */ - public IResource onBeforeResourceStarted(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onBeforeResourceStarted", reqArgs); + public ExecutableResource withIconName(String iconName) { + return withIconName(iconName, null); } - /** Subscribes to the ResourceStopped event */ - public IResource onResourceStopped(Function callback) { + /** Sets the icon for the resource */ + public ExecutableResource withIconName(String iconName, IconVariant iconVariant) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + reqArgs.put("iconName", AspireClient.serializeValue(iconName)); + if (iconVariant != null) { + reqArgs.put("iconVariant", AspireClient.serializeValue(iconVariant)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onResourceStopped", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withIconName", reqArgs); + return this; } - /** Subscribes to the InitializeResource event */ - public IResource onInitializeResource(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onInitializeResource", reqArgs); + /** Adds an HTTP health probe to the resource */ + public ExecutableResource withHttpProbe(ProbeType probeType, WithHttpProbeOptions options) { + var path = options == null ? null : options.getPath(); + var initialDelaySeconds = options == null ? null : options.getInitialDelaySeconds(); + var periodSeconds = options == null ? null : options.getPeriodSeconds(); + var timeoutSeconds = options == null ? null : options.getTimeoutSeconds(); + var failureThreshold = options == null ? null : options.getFailureThreshold(); + var successThreshold = options == null ? null : options.getSuccessThreshold(); + var endpointName = options == null ? null : options.getEndpointName(); + return withHttpProbeImpl(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName); } - /** Subscribes to the ResourceReady event */ - public IResource onResourceReady(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onResourceReady", reqArgs); + public ExecutableResource withHttpProbe(ProbeType probeType) { + return withHttpProbe(probeType, null); } - /** Adds an optional string parameter */ - public IResource withOptionalString(String value, Boolean enabled) { + /** Adds an HTTP health probe to the resource */ + private ExecutableResource withHttpProbeImpl(ProbeType probeType, String path, Double initialDelaySeconds, Double periodSeconds, Double timeoutSeconds, Double failureThreshold, Double successThreshold, String endpointName) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (value != null) { - reqArgs.put("value", AspireClient.serializeValue(value)); + reqArgs.put("probeType", AspireClient.serializeValue(probeType)); + if (path != null) { + reqArgs.put("path", AspireClient.serializeValue(path)); } - if (enabled != null) { - reqArgs.put("enabled", AspireClient.serializeValue(enabled)); + if (initialDelaySeconds != null) { + reqArgs.put("initialDelaySeconds", AspireClient.serializeValue(initialDelaySeconds)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalString", reqArgs); + if (periodSeconds != null) { + reqArgs.put("periodSeconds", AspireClient.serializeValue(periodSeconds)); + } + if (timeoutSeconds != null) { + reqArgs.put("timeoutSeconds", AspireClient.serializeValue(timeoutSeconds)); + } + if (failureThreshold != null) { + reqArgs.put("failureThreshold", AspireClient.serializeValue(failureThreshold)); + } + if (successThreshold != null) { + reqArgs.put("successThreshold", AspireClient.serializeValue(successThreshold)); + } + if (endpointName != null) { + reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + } + getClient().invokeCapability("Aspire.Hosting/withHttpProbe", reqArgs); + return this; } - /** Configures the resource with a DTO */ - public IResource withConfig(TestConfigDto config) { + /** Excludes the resource from MCP server exposure */ + public ExecutableResource excludeFromMcp() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("config", AspireClient.serializeValue(config)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConfig", reqArgs); + getClient().invokeCapability("Aspire.Hosting/excludeFromMcp", reqArgs); + return this; } - /** Sets the created timestamp */ - public IResource withCreatedAt(String createdAt) { + /** Sets the remote image name for publishing */ + public ExecutableResource withRemoteImageName(String remoteImageName) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("createdAt", AspireClient.serializeValue(createdAt)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCreatedAt", reqArgs); + reqArgs.put("remoteImageName", AspireClient.serializeValue(remoteImageName)); + getClient().invokeCapability("Aspire.Hosting/withRemoteImageName", reqArgs); + return this; } - /** Sets the modified timestamp */ - public IResource withModifiedAt(String modifiedAt) { + /** Sets the remote image tag for publishing */ + public ExecutableResource withRemoteImageTag(String remoteImageTag) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("modifiedAt", AspireClient.serializeValue(modifiedAt)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withModifiedAt", reqArgs); + reqArgs.put("remoteImageTag", AspireClient.serializeValue(remoteImageTag)); + getClient().invokeCapability("Aspire.Hosting/withRemoteImageTag", reqArgs); + return this; } - /** Sets the correlation ID */ - public IResource withCorrelationId(String correlationId) { + /** Adds a pipeline step to the resource */ + public ExecutableResource withPipelineStepFactory(String stepName, AspireAction1 callback, WithPipelineStepFactoryOptions options) { + var dependsOn = options == null ? null : options.getDependsOn(); + var requiredBy = options == null ? null : options.getRequiredBy(); + var tags = options == null ? null : options.getTags(); + var description = options == null ? null : options.getDescription(); + return withPipelineStepFactoryImpl(stepName, callback, dependsOn, requiredBy, tags, description); + } + + public ExecutableResource withPipelineStepFactory(String stepName, AspireAction1 callback) { + return withPipelineStepFactory(stepName, callback, null); + } + + /** Adds a pipeline step to the resource */ + private ExecutableResource withPipelineStepFactoryImpl(String stepName, AspireAction1 callback, String[] dependsOn, String[] requiredBy, String[] tags, String description) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("correlationId", AspireClient.serializeValue(correlationId)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCorrelationId", reqArgs); + reqArgs.put("stepName", AspireClient.serializeValue(stepName)); + var callbackId = getClient().registerCallback(args -> { + var arg = (PipelineStepContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + if (dependsOn != null) { + reqArgs.put("dependsOn", AspireClient.serializeValue(dependsOn)); + } + if (requiredBy != null) { + reqArgs.put("requiredBy", AspireClient.serializeValue(requiredBy)); + } + if (tags != null) { + reqArgs.put("tags", AspireClient.serializeValue(tags)); + } + if (description != null) { + reqArgs.put("description", AspireClient.serializeValue(description)); + } + getClient().invokeCapability("Aspire.Hosting/withPipelineStepFactory", reqArgs); + return this; } - /** Configures with optional callback */ - public IResource withOptionalCallback(Function callback) { + /** Configures pipeline step dependencies via an async callback */ + public ExecutableResource withPipelineConfigurationAsync(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var arg = (PipelineConfigurationContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalCallback", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withPipelineConfigurationAsync", reqArgs); + return this; } - /** Sets the resource status */ - public IResource withStatus(TestResourceStatus status) { + /** Configures pipeline step dependencies via a callback */ + public ExecutableResource withPipelineConfiguration(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("status", AspireClient.serializeValue(status)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withStatus", reqArgs); + var callbackId = getClient().registerCallback(args -> { + var obj = (PipelineConfigurationContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withPipelineConfiguration", reqArgs); + return this; } - /** Configures with nested DTO */ - public IResource withNestedConfig(TestNestedDto config) { + /** Gets the resource name */ + public String getResourceName() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("config", AspireClient.serializeValue(config)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withNestedConfig", reqArgs); + reqArgs.put("resource", AspireClient.serializeValue(getHandle())); + return (String) getClient().invokeCapability("Aspire.Hosting/getResourceName", reqArgs); } - /** Adds validation callback */ - public IResource withValidator(Function validator) { + /** Subscribes to the BeforeResourceStarted event */ + public ExecutableResource onBeforeResourceStarted(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (validator != null) { - reqArgs.put("validator", getClient().registerCallback(validator)); + var callbackId = getClient().registerCallback(args -> { + var arg = (BeforeResourceStartedEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withValidator", reqArgs); + getClient().invokeCapability("Aspire.Hosting/onBeforeResourceStarted", reqArgs); + return this; } - /** Waits for another resource (test version) */ - public IResource testWaitFor(IResource dependency) { + /** Subscribes to the ResourceStopped event */ + public ExecutableResource onResourceStopped(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWaitFor", reqArgs); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceStoppedEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onResourceStopped", reqArgs); + return this; } - /** Adds a dependency on another resource */ - public IResource withDependency(IResourceWithConnectionString dependency) { + /** Subscribes to the InitializeResource event */ + public ExecutableResource onInitializeResource(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDependency", reqArgs); + var callbackId = getClient().registerCallback(args -> { + var arg = (InitializeResourceEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onInitializeResource", reqArgs); + return this; } - /** Sets the endpoints */ - public IResource withEndpoints(String[] endpoints) { + /** Subscribes to the ResourceEndpointsAllocated event */ + public ExecutableResource onResourceEndpointsAllocated(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("endpoints", AspireClient.serializeValue(endpoints)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEndpoints", reqArgs); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceEndpointsAllocatedEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onResourceEndpointsAllocated", reqArgs); + return this; } - /** Performs a cancellable operation */ - public IResource withCancellableOperation(Function operation) { + /** Subscribes to the ResourceReady event */ + public ExecutableResource onResourceReady(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (operation != null) { - reqArgs.put("operation", getClient().registerCallback(operation)); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceReadyEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCancellableOperation", reqArgs); + getClient().invokeCapability("Aspire.Hosting/onResourceReady", reqArgs); + return this; } -} - -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource. */ -class ContainerResource extends ResourceBuilderBase { - ContainerResource(Handle handle, AspireClient client) { - super(handle, client); + /** Adds an optional string parameter */ + public ExecutableResource withOptionalString(WithOptionalStringOptions options) { + var value = options == null ? null : options.getValue(); + var enabled = options == null ? null : options.getEnabled(); + return withOptionalStringImpl(value, enabled); } - /** Configures a resource to use a container registry */ - public IResource withContainerRegistry(IResource registry) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("registry", AspireClient.serializeValue(registry)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withContainerRegistry", reqArgs); + public ExecutableResource withOptionalString() { + return withOptionalString(null); } - /** Adds a bind mount */ - public ContainerResource withBindMount(String source, String target, Boolean isReadOnly) { + /** Adds an optional string parameter */ + private ExecutableResource withOptionalStringImpl(String value, Boolean enabled) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("source", AspireClient.serializeValue(source)); - reqArgs.put("target", AspireClient.serializeValue(target)); - if (isReadOnly != null) { - reqArgs.put("isReadOnly", AspireClient.serializeValue(isReadOnly)); + if (value != null) { + reqArgs.put("value", AspireClient.serializeValue(value)); } - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withBindMount", reqArgs); + if (enabled != null) { + reqArgs.put("enabled", AspireClient.serializeValue(enabled)); + } + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalString", reqArgs); + return this; } - /** Sets the container entrypoint */ - public ContainerResource withEntrypoint(String entrypoint) { + /** Configures the resource with a DTO */ + public ExecutableResource withConfig(TestConfigDto config) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("entrypoint", AspireClient.serializeValue(entrypoint)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withEntrypoint", reqArgs); + reqArgs.put("config", AspireClient.serializeValue(config)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConfig", reqArgs); + return this; } - /** Sets the container image tag */ - public ContainerResource withImageTag(String tag) { + /** Configures environment with callback (test version) */ + public ExecutableResource testWithEnvironmentCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("tag", AspireClient.serializeValue(tag)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withImageTag", reqArgs); + var callbackId = getClient().registerCallback(args -> { + var arg = (TestEnvironmentContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWithEnvironmentCallback", reqArgs); + return this; } - /** Sets the container image registry */ - public ContainerResource withImageRegistry(String registry) { + /** Sets the created timestamp */ + public ExecutableResource withCreatedAt(String createdAt) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("registry", AspireClient.serializeValue(registry)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withImageRegistry", reqArgs); + reqArgs.put("createdAt", AspireClient.serializeValue(createdAt)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCreatedAt", reqArgs); + return this; } - /** Sets the container image */ - public ContainerResource withImage(String image, String tag) { + /** Sets the modified timestamp */ + public ExecutableResource withModifiedAt(String modifiedAt) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("image", AspireClient.serializeValue(image)); - if (tag != null) { - reqArgs.put("tag", AspireClient.serializeValue(tag)); - } - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withImage", reqArgs); + reqArgs.put("modifiedAt", AspireClient.serializeValue(modifiedAt)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withModifiedAt", reqArgs); + return this; } - /** Sets the image SHA256 digest */ - public ContainerResource withImageSHA256(String sha256) { + /** Sets the correlation ID */ + public ExecutableResource withCorrelationId(String correlationId) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("sha256", AspireClient.serializeValue(sha256)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withImageSHA256", reqArgs); + reqArgs.put("correlationId", AspireClient.serializeValue(correlationId)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCorrelationId", reqArgs); + return this; } - /** Adds runtime arguments for the container */ - public ContainerResource withContainerRuntimeArgs(String[] args) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("args", AspireClient.serializeValue(args)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withContainerRuntimeArgs", reqArgs); + public ExecutableResource withOptionalCallback() { + return withOptionalCallback(null); } - /** Sets the lifetime behavior of the container resource */ - public ContainerResource withLifetime(ContainerLifetime lifetime) { + /** Configures with optional callback */ + public ExecutableResource withOptionalCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("lifetime", AspireClient.serializeValue(lifetime)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withLifetime", reqArgs); + var callbackId = callback == null ? null : getClient().registerCallback(args -> { + var arg = (TestCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalCallback", reqArgs); + return this; } - /** Sets the container image pull policy */ - public ContainerResource withImagePullPolicy(ImagePullPolicy pullPolicy) { + /** Sets the resource status */ + public ExecutableResource withStatus(TestResourceStatus status) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("pullPolicy", AspireClient.serializeValue(pullPolicy)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withImagePullPolicy", reqArgs); + reqArgs.put("status", AspireClient.serializeValue(status)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withStatus", reqArgs); + return this; } - /** Configures the resource to be published as a container */ - public ContainerResource publishAsContainer() { + /** Configures with nested DTO */ + public ExecutableResource withNestedConfig(TestNestedDto config) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/publishAsContainer", reqArgs); + reqArgs.put("config", AspireClient.serializeValue(config)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withNestedConfig", reqArgs); + return this; } - /** Configures the resource to use a Dockerfile */ - public ContainerResource withDockerfile(String contextPath, String dockerfilePath, String stage) { + /** Adds validation callback */ + public ExecutableResource withValidator(AspireFunc1 validator) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("contextPath", AspireClient.serializeValue(contextPath)); - if (dockerfilePath != null) { - reqArgs.put("dockerfilePath", AspireClient.serializeValue(dockerfilePath)); - } - if (stage != null) { - reqArgs.put("stage", AspireClient.serializeValue(stage)); + var validatorId = getClient().registerCallback(args -> { + var arg = (TestResourceContext) args[0]; + return AspireClient.awaitValue(validator.invoke(arg)); + }); + if (validatorId != null) { + reqArgs.put("validator", validatorId); } - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withDockerfile", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withValidator", reqArgs); + return this; } - /** Sets the container name */ - public ContainerResource withContainerName(String name) { + /** Waits for another resource (test version) */ + public ExecutableResource testWaitFor(IResource dependency) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withContainerName", reqArgs); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWaitFor", reqArgs); + return this; } - /** Adds a build argument from a parameter resource */ - public ContainerResource withBuildArg(String name, ParameterResource value) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withBuildArg", reqArgs); + public ExecutableResource testWaitFor(ResourceBuilderBase dependency) { + return testWaitFor(new IResource(dependency.getHandle(), dependency.getClient())); } - /** Adds a build secret from a parameter resource */ - public ContainerResource withBuildSecret(String name, ParameterResource value) { + /** Adds a dependency on another resource */ + public ExecutableResource withDependency(IResourceWithConnectionString dependency) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withBuildSecret", reqArgs); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDependency", reqArgs); + return this; } - /** Configures endpoint proxy support */ - public ContainerResource withEndpointProxySupport(boolean proxyEnabled) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("proxyEnabled", AspireClient.serializeValue(proxyEnabled)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withEndpointProxySupport", reqArgs); + public ExecutableResource withDependency(ResourceBuilderBase dependency) { + return withDependency(new IResourceWithConnectionString(dependency.getHandle(), dependency.getClient())); } - /** Sets the base image for a Dockerfile build */ - public IResource withDockerfileBaseImage(String buildImage, String runtimeImage) { + /** Sets the endpoints */ + public ExecutableResource withEndpoints(String[] endpoints) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (buildImage != null) { - reqArgs.put("buildImage", AspireClient.serializeValue(buildImage)); - } - if (runtimeImage != null) { - reqArgs.put("runtimeImage", AspireClient.serializeValue(runtimeImage)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withDockerfileBaseImage", reqArgs); + reqArgs.put("endpoints", AspireClient.serializeValue(endpoints)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEndpoints", reqArgs); + return this; } - /** Adds a network alias for the container */ - public ContainerResource withContainerNetworkAlias(String alias) { + /** Sets environment variables */ + public ExecutableResource withEnvironmentVariables(Map variables) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("alias", AspireClient.serializeValue(alias)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withContainerNetworkAlias", reqArgs); + reqArgs.put("variables", AspireClient.serializeValue(variables)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEnvironmentVariables", reqArgs); + return this; } - /** Configures an MCP server endpoint on the resource */ - public IResourceWithEndpoints withMcpServer(String path, String endpointName) { + /** Performs a cancellable operation */ + public ExecutableResource withCancellableOperation(AspireAction1 operation) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (path != null) { - reqArgs.put("path", AspireClient.serializeValue(path)); - } - if (endpointName != null) { - reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + var operationId = getClient().registerCallback(args -> { + var arg = CancellationToken.fromValue(args[0]); + operation.invoke(arg); + return null; + }); + if (operationId != null) { + reqArgs.put("operation", operationId); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withMcpServer", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCancellableOperation", reqArgs); + return this; } - /** Configures OTLP telemetry export */ - public IResourceWithEnvironment withOtlpExporter() { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withOtlpExporter", reqArgs); +} + +// ===== ExecuteCommandContext.java ===== +// ExecuteCommandContext.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext. */ +public class ExecuteCommandContext extends HandleWrapperBase { + ExecuteCommandContext(Handle handle, AspireClient client) { + super(handle, client); } - /** Configures OTLP telemetry export with specific protocol */ - public IResourceWithEnvironment withOtlpExporterProtocol(OtlpProtocol protocol) { + /** Gets the ServiceProvider property */ + public IServiceProvider serviceProvider() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("protocol", AspireClient.serializeValue(protocol)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withOtlpExporterProtocol", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (IServiceProvider) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ExecuteCommandContext.serviceProvider", reqArgs); } - /** Publishes the resource as a connection string */ - public ContainerResource publishAsConnectionString() { + /** Sets the ServiceProvider property */ + public ExecuteCommandContext setServiceProvider(IServiceProvider value) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/publishAsConnectionString", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + reqArgs.put("value", AspireClient.serializeValue(value)); + return (ExecuteCommandContext) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setServiceProvider", reqArgs); } - /** Adds a required command dependency */ - public IResource withRequiredCommand(String command, String helpLink) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("command", AspireClient.serializeValue(command)); - if (helpLink != null) { - reqArgs.put("helpLink", AspireClient.serializeValue(helpLink)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withRequiredCommand", reqArgs); + public ExecuteCommandContext setServiceProvider(HandleWrapperBase value) { + return setServiceProvider(new IServiceProvider(value.getHandle(), value.getClient())); } - /** Sets an environment variable */ - public IResourceWithEnvironment withEnvironment(String name, String value) { + /** Gets the ResourceName property */ + public String resourceName() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironment", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (String) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ExecuteCommandContext.resourceName", reqArgs); } - /** Adds an environment variable with a reference expression */ - public IResourceWithEnvironment withEnvironmentExpression(String name, ReferenceExpression value) { + /** Sets the ResourceName property */ + public ExecuteCommandContext setResourceName(String value) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); reqArgs.put("value", AspireClient.serializeValue(value)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentExpression", reqArgs); + return (ExecuteCommandContext) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setResourceName", reqArgs); } - /** Sets environment variables via callback */ - public IResourceWithEnvironment withEnvironmentCallback(Function callback) { + /** Gets the CancellationToken property */ + public CancellationToken cancellationToken() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentCallback", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (CancellationToken) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ExecuteCommandContext.cancellationToken", reqArgs); } - /** Sets environment variables via async callback */ - public IResourceWithEnvironment withEnvironmentCallbackAsync(Function callback) { + /** Sets the CancellationToken property */ + public ExecuteCommandContext setCancellationToken(CancellationToken value) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + if (value != null) { + reqArgs.put("value", getClient().registerCancellation(value)); } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentCallbackAsync", reqArgs); + return (ExecuteCommandContext) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setCancellationToken", reqArgs); } - /** Sets an environment variable from an endpoint reference */ - public IResourceWithEnvironment withEnvironmentEndpoint(String name, EndpointReference endpointReference) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("endpointReference", AspireClient.serializeValue(endpointReference)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentEndpoint", reqArgs); - } +} - /** Sets an environment variable from a parameter resource */ - public IResourceWithEnvironment withEnvironmentParameter(String name, ParameterResource parameter) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("parameter", AspireClient.serializeValue(parameter)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentParameter", reqArgs); - } +// ===== ExecuteCommandResult.java ===== +// ExecuteCommandResult.java - GENERATED CODE - DO NOT EDIT - /** Sets an environment variable from a connection string resource */ - public IResourceWithEnvironment withEnvironmentConnectionString(String envVarName, IResourceWithConnectionString resource) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("envVarName", AspireClient.serializeValue(envVarName)); - reqArgs.put("resource", AspireClient.serializeValue(resource)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentConnectionString", reqArgs); +package aspire; + +import java.util.*; +import java.util.function.*; + +/** ExecuteCommandResult DTO. */ +public class ExecuteCommandResult { + private boolean success; + private boolean canceled; + private String errorMessage; + + public boolean getSuccess() { return success; } + public void setSuccess(boolean value) { this.success = value; } + public boolean getCanceled() { return canceled; } + public void setCanceled(boolean value) { this.canceled = value; } + public String getErrorMessage() { return errorMessage; } + public void setErrorMessage(String value) { this.errorMessage = value; } + + public Map toMap() { + Map map = new HashMap<>(); + map.put("Success", AspireClient.serializeValue(success)); + map.put("Canceled", AspireClient.serializeValue(canceled)); + map.put("ErrorMessage", AspireClient.serializeValue(errorMessage)); + return map; } +} - /** Adds arguments */ - public IResourceWithArgs withArgs(String[] args) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("args", AspireClient.serializeValue(args)); - return (IResourceWithArgs) getClient().invokeCapability("Aspire.Hosting/withArgs", reqArgs); - } +// ===== ExternalServiceResource.java ===== +// ExternalServiceResource.java - GENERATED CODE - DO NOT EDIT - /** Sets command-line arguments via callback */ - public IResourceWithArgs withArgsCallback(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResourceWithArgs) getClient().invokeCapability("Aspire.Hosting/withArgsCallback", reqArgs); - } +package aspire; - /** Sets command-line arguments via async callback */ - public IResourceWithArgs withArgsCallbackAsync(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResourceWithArgs) getClient().invokeCapability("Aspire.Hosting/withArgsCallbackAsync", reqArgs); +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ExternalServiceResource. */ +public class ExternalServiceResource extends ResourceBuilderBase { + ExternalServiceResource(Handle handle, AspireClient client) { + super(handle, client); } - /** Adds a reference to another resource */ - public IResourceWithEnvironment withReference(IResource source, String connectionName, Boolean optional, String name) { + /** Configures a resource to use a container registry */ + public ExternalServiceResource withContainerRegistry(IResource registry) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("source", AspireClient.serializeValue(source)); - if (connectionName != null) { - reqArgs.put("connectionName", AspireClient.serializeValue(connectionName)); - } - if (optional != null) { - reqArgs.put("optional", AspireClient.serializeValue(optional)); - } - if (name != null) { - reqArgs.put("name", AspireClient.serializeValue(name)); - } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withReference", reqArgs); + reqArgs.put("registry", AspireClient.serializeValue(registry)); + getClient().invokeCapability("Aspire.Hosting/withContainerRegistry", reqArgs); + return this; } - /** Adds a reference to a URI */ - public IResourceWithEnvironment withReferenceUri(String name, String uri) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("uri", AspireClient.serializeValue(uri)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withReferenceUri", reqArgs); + public ExternalServiceResource withContainerRegistry(ResourceBuilderBase registry) { + return withContainerRegistry(new IResource(registry.getHandle(), registry.getClient())); } - /** Adds a reference to an external service */ - public IResourceWithEnvironment withReferenceExternalService(ExternalServiceResource externalService) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("externalService", AspireClient.serializeValue(externalService)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withReferenceExternalService", reqArgs); + /** Sets the base image for a Dockerfile build */ + public ExternalServiceResource withDockerfileBaseImage(WithDockerfileBaseImageOptions options) { + var buildImage = options == null ? null : options.getBuildImage(); + var runtimeImage = options == null ? null : options.getRuntimeImage(); + return withDockerfileBaseImageImpl(buildImage, runtimeImage); } - /** Adds a reference to an endpoint */ - public IResourceWithEnvironment withReferenceEndpoint(EndpointReference endpointReference) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("endpointReference", AspireClient.serializeValue(endpointReference)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withReferenceEndpoint", reqArgs); + public ExternalServiceResource withDockerfileBaseImage() { + return withDockerfileBaseImage(null); } - /** Adds a network endpoint */ - public IResourceWithEndpoints withEndpoint(Double port, Double targetPort, String scheme, String name, String env, Boolean isProxied, Boolean isExternal, ProtocolType protocol) { + /** Sets the base image for a Dockerfile build */ + private ExternalServiceResource withDockerfileBaseImageImpl(String buildImage, String runtimeImage) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (port != null) { - reqArgs.put("port", AspireClient.serializeValue(port)); - } - if (targetPort != null) { - reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); - } - if (scheme != null) { - reqArgs.put("scheme", AspireClient.serializeValue(scheme)); - } - if (name != null) { - reqArgs.put("name", AspireClient.serializeValue(name)); - } - if (env != null) { - reqArgs.put("env", AspireClient.serializeValue(env)); - } - if (isProxied != null) { - reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); - } - if (isExternal != null) { - reqArgs.put("isExternal", AspireClient.serializeValue(isExternal)); + if (buildImage != null) { + reqArgs.put("buildImage", AspireClient.serializeValue(buildImage)); } - if (protocol != null) { - reqArgs.put("protocol", AspireClient.serializeValue(protocol)); + if (runtimeImage != null) { + reqArgs.put("runtimeImage", AspireClient.serializeValue(runtimeImage)); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withEndpoint", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withDockerfileBaseImage", reqArgs); + return this; } - /** Adds an HTTP endpoint */ - public IResourceWithEndpoints withHttpEndpoint(Double port, Double targetPort, String name, String env, Boolean isProxied) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (port != null) { - reqArgs.put("port", AspireClient.serializeValue(port)); - } - if (targetPort != null) { - reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); - } - if (name != null) { - reqArgs.put("name", AspireClient.serializeValue(name)); - } - if (env != null) { - reqArgs.put("env", AspireClient.serializeValue(env)); - } - if (isProxied != null) { - reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); - } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withHttpEndpoint", reqArgs); + /** Adds an HTTP health check to an external service */ + public ExternalServiceResource withExternalServiceHttpHealthCheck(WithExternalServiceHttpHealthCheckOptions options) { + var path = options == null ? null : options.getPath(); + var statusCode = options == null ? null : options.getStatusCode(); + return withExternalServiceHttpHealthCheckImpl(path, statusCode); } - /** Adds an HTTPS endpoint */ - public IResourceWithEndpoints withHttpsEndpoint(Double port, Double targetPort, String name, String env, Boolean isProxied) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (port != null) { - reqArgs.put("port", AspireClient.serializeValue(port)); - } - if (targetPort != null) { - reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); - } - if (name != null) { - reqArgs.put("name", AspireClient.serializeValue(name)); - } - if (env != null) { - reqArgs.put("env", AspireClient.serializeValue(env)); - } - if (isProxied != null) { - reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); - } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withHttpsEndpoint", reqArgs); + public ExternalServiceResource withExternalServiceHttpHealthCheck() { + return withExternalServiceHttpHealthCheck(null); } - /** Makes HTTP endpoints externally accessible */ - public IResourceWithEndpoints withExternalHttpEndpoints() { + /** Adds an HTTP health check to an external service */ + private ExternalServiceResource withExternalServiceHttpHealthCheckImpl(String path, Double statusCode) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withExternalHttpEndpoints", reqArgs); + if (path != null) { + reqArgs.put("path", AspireClient.serializeValue(path)); + } + if (statusCode != null) { + reqArgs.put("statusCode", AspireClient.serializeValue(statusCode)); + } + getClient().invokeCapability("Aspire.Hosting/withExternalServiceHttpHealthCheck", reqArgs); + return this; } - /** Gets an endpoint reference */ - public EndpointReference getEndpoint(String name) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - return (EndpointReference) getClient().invokeCapability("Aspire.Hosting/getEndpoint", reqArgs); + public ExternalServiceResource withRequiredCommand(String command) { + return withRequiredCommand(command, null); } - /** Configures resource for HTTP/2 */ - public IResourceWithEndpoints asHttp2Service() { + /** Adds a required command dependency */ + public ExternalServiceResource withRequiredCommand(String command, String helpLink) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/asHttp2Service", reqArgs); + reqArgs.put("command", AspireClient.serializeValue(command)); + if (helpLink != null) { + reqArgs.put("helpLink", AspireClient.serializeValue(helpLink)); + } + getClient().invokeCapability("Aspire.Hosting/withRequiredCommand", reqArgs); + return this; } /** Customizes displayed URLs via callback */ - public IResource withUrlsCallback(Function callback) { + public ExternalServiceResource withUrlsCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var obj = (ResourceUrlsCallbackContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlsCallback", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrlsCallback", reqArgs); + return this; } /** Customizes displayed URLs via async callback */ - public IResource withUrlsCallbackAsync(Function callback) { + public ExternalServiceResource withUrlsCallbackAsync(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceUrlsCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlsCallbackAsync", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrlsCallbackAsync", reqArgs); + return this; + } + + public ExternalServiceResource withUrl(String url) { + return withUrl(url, null); } /** Adds or modifies displayed URLs */ - public IResource withUrl(String url, String displayText) { + public ExternalServiceResource withUrl(String url, String displayText) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("url", AspireClient.serializeValue(url)); if (displayText != null) { reqArgs.put("displayText", AspireClient.serializeValue(displayText)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrl", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrl", reqArgs); + return this; + } + + public ExternalServiceResource withUrlExpression(ReferenceExpression url) { + return withUrlExpression(url, null); } /** Adds a URL using a reference expression */ - public IResource withUrlExpression(ReferenceExpression url, String displayText) { + public ExternalServiceResource withUrlExpression(ReferenceExpression url, String displayText) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("url", AspireClient.serializeValue(url)); if (displayText != null) { reqArgs.put("displayText", AspireClient.serializeValue(displayText)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlExpression", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrlExpression", reqArgs); + return this; } /** Customizes the URL for a specific endpoint via callback */ - public IResource withUrlForEndpoint(String endpointName, Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlForEndpoint", reqArgs); - } - - /** Adds a URL for a specific endpoint via factory callback */ - public IResourceWithEndpoints withUrlForEndpointFactory(String endpointName, Function callback) { + public ExternalServiceResource withUrlForEndpoint(String endpointName, AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var obj = (ResourceUrlAnnotation) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withUrlForEndpointFactory", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrlForEndpoint", reqArgs); + return this; } /** Excludes the resource from the deployment manifest */ - public IResource excludeFromManifest() { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/excludeFromManifest", reqArgs); - } - - /** Waits for another resource to be ready */ - public IResourceWithWaitSupport waitFor(IResource dependency) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitFor", reqArgs); - } - - /** Waits for another resource with specific behavior */ - public IResourceWithWaitSupport waitForWithBehavior(IResource dependency, WaitBehavior waitBehavior) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - reqArgs.put("waitBehavior", AspireClient.serializeValue(waitBehavior)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForWithBehavior", reqArgs); - } - - /** Waits for another resource to start */ - public IResourceWithWaitSupport waitForStart(IResource dependency) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForStart", reqArgs); - } - - /** Waits for another resource to start with specific behavior */ - public IResourceWithWaitSupport waitForStartWithBehavior(IResource dependency, WaitBehavior waitBehavior) { + public ExternalServiceResource excludeFromManifest() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - reqArgs.put("waitBehavior", AspireClient.serializeValue(waitBehavior)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForStartWithBehavior", reqArgs); + getClient().invokeCapability("Aspire.Hosting/excludeFromManifest", reqArgs); + return this; } /** Prevents resource from starting automatically */ - public IResource withExplicitStart() { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withExplicitStart", reqArgs); - } - - /** Waits for resource completion */ - public IResourceWithWaitSupport waitForCompletion(IResource dependency, Double exitCode) { + public ExternalServiceResource withExplicitStart() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - if (exitCode != null) { - reqArgs.put("exitCode", AspireClient.serializeValue(exitCode)); - } - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForCompletion", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withExplicitStart", reqArgs); + return this; } /** Adds a health check by key */ - public IResource withHealthCheck(String key) { + public ExternalServiceResource withHealthCheck(String key) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("key", AspireClient.serializeValue(key)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withHealthCheck", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withHealthCheck", reqArgs); + return this; } - /** Adds an HTTP health check */ - public IResourceWithEndpoints withHttpHealthCheck(String path, Double statusCode, String endpointName) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (path != null) { - reqArgs.put("path", AspireClient.serializeValue(path)); - } - if (statusCode != null) { - reqArgs.put("statusCode", AspireClient.serializeValue(statusCode)); - } - if (endpointName != null) { - reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); - } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withHttpHealthCheck", reqArgs); + public ExternalServiceResource withCommand(String name, String displayName, AspireFunc1 executeCommand) { + return withCommand(name, displayName, executeCommand, null); } /** Adds a resource command */ - public IResource withCommand(String name, String displayName, Function executeCommand, CommandOptions commandOptions) { + public ExternalServiceResource withCommand(String name, String displayName, AspireFunc1 executeCommand, CommandOptions commandOptions) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("name", AspireClient.serializeValue(name)); reqArgs.put("displayName", AspireClient.serializeValue(displayName)); - if (executeCommand != null) { - reqArgs.put("executeCommand", getClient().registerCallback(executeCommand)); + var executeCommandId = getClient().registerCallback(args -> { + var arg = (ExecuteCommandContext) args[0]; + return AspireClient.awaitValue(executeCommand.invoke(arg)); + }); + if (executeCommandId != null) { + reqArgs.put("executeCommand", executeCommandId); } if (commandOptions != null) { reqArgs.put("commandOptions", AspireClient.serializeValue(commandOptions)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withCommand", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withCommand", reqArgs); + return this; } - /** Configures developer certificate trust */ - public IResourceWithEnvironment withDeveloperCertificateTrust(boolean trust) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("trust", AspireClient.serializeValue(trust)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withDeveloperCertificateTrust", reqArgs); - } - - /** Sets the certificate trust scope */ - public IResourceWithEnvironment withCertificateTrustScope(CertificateTrustScope scope) { + /** Sets the parent relationship */ + public ExternalServiceResource withParentRelationship(IResource parent) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("scope", AspireClient.serializeValue(scope)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withCertificateTrustScope", reqArgs); + reqArgs.put("parent", AspireClient.serializeValue(parent)); + getClient().invokeCapability("Aspire.Hosting/withParentRelationship", reqArgs); + return this; } - /** Configures HTTPS with a developer certificate */ - public IResourceWithEnvironment withHttpsDeveloperCertificate(ParameterResource password) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (password != null) { - reqArgs.put("password", AspireClient.serializeValue(password)); - } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withHttpsDeveloperCertificate", reqArgs); + public ExternalServiceResource withParentRelationship(ResourceBuilderBase parent) { + return withParentRelationship(new IResource(parent.getHandle(), parent.getClient())); } - /** Removes HTTPS certificate configuration */ - public IResourceWithEnvironment withoutHttpsCertificate() { + /** Sets a child relationship */ + public ExternalServiceResource withChildRelationship(IResource child) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withoutHttpsCertificate", reqArgs); + reqArgs.put("child", AspireClient.serializeValue(child)); + getClient().invokeCapability("Aspire.Hosting/withChildRelationship", reqArgs); + return this; } - /** Sets the parent relationship */ - public IResource withParentRelationship(IResource parent) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("parent", AspireClient.serializeValue(parent)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withParentRelationship", reqArgs); + public ExternalServiceResource withChildRelationship(ResourceBuilderBase child) { + return withChildRelationship(new IResource(child.getHandle(), child.getClient())); } - /** Sets a child relationship */ - public IResource withChildRelationship(IResource child) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("child", AspireClient.serializeValue(child)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withChildRelationship", reqArgs); + public ExternalServiceResource withIconName(String iconName) { + return withIconName(iconName, null); } /** Sets the icon for the resource */ - public IResource withIconName(String iconName, IconVariant iconVariant) { + public ExternalServiceResource withIconName(String iconName, IconVariant iconVariant) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("iconName", AspireClient.serializeValue(iconName)); if (iconVariant != null) { reqArgs.put("iconVariant", AspireClient.serializeValue(iconVariant)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withIconName", reqArgs); - } - - /** Adds an HTTP health probe to the resource */ - public IResourceWithEndpoints withHttpProbe(ProbeType probeType, String path, Double initialDelaySeconds, Double periodSeconds, Double timeoutSeconds, Double failureThreshold, Double successThreshold, String endpointName) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("probeType", AspireClient.serializeValue(probeType)); - if (path != null) { - reqArgs.put("path", AspireClient.serializeValue(path)); - } - if (initialDelaySeconds != null) { - reqArgs.put("initialDelaySeconds", AspireClient.serializeValue(initialDelaySeconds)); - } - if (periodSeconds != null) { - reqArgs.put("periodSeconds", AspireClient.serializeValue(periodSeconds)); - } - if (timeoutSeconds != null) { - reqArgs.put("timeoutSeconds", AspireClient.serializeValue(timeoutSeconds)); - } - if (failureThreshold != null) { - reqArgs.put("failureThreshold", AspireClient.serializeValue(failureThreshold)); - } - if (successThreshold != null) { - reqArgs.put("successThreshold", AspireClient.serializeValue(successThreshold)); - } - if (endpointName != null) { - reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); - } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withHttpProbe", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withIconName", reqArgs); + return this; } /** Excludes the resource from MCP server exposure */ - public IResource excludeFromMcp() { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/excludeFromMcp", reqArgs); - } - - /** Sets the remote image name for publishing */ - public IComputeResource withRemoteImageName(String remoteImageName) { + public ExternalServiceResource excludeFromMcp() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("remoteImageName", AspireClient.serializeValue(remoteImageName)); - return (IComputeResource) getClient().invokeCapability("Aspire.Hosting/withRemoteImageName", reqArgs); + getClient().invokeCapability("Aspire.Hosting/excludeFromMcp", reqArgs); + return this; } - /** Sets the remote image tag for publishing */ - public IComputeResource withRemoteImageTag(String remoteImageTag) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("remoteImageTag", AspireClient.serializeValue(remoteImageTag)); - return (IComputeResource) getClient().invokeCapability("Aspire.Hosting/withRemoteImageTag", reqArgs); + /** Adds a pipeline step to the resource */ + public ExternalServiceResource withPipelineStepFactory(String stepName, AspireAction1 callback, WithPipelineStepFactoryOptions options) { + var dependsOn = options == null ? null : options.getDependsOn(); + var requiredBy = options == null ? null : options.getRequiredBy(); + var tags = options == null ? null : options.getTags(); + var description = options == null ? null : options.getDescription(); + return withPipelineStepFactoryImpl(stepName, callback, dependsOn, requiredBy, tags, description); + } + + public ExternalServiceResource withPipelineStepFactory(String stepName, AspireAction1 callback) { + return withPipelineStepFactory(stepName, callback, null); } /** Adds a pipeline step to the resource */ - public IResource withPipelineStepFactory(String stepName, Function callback, String[] dependsOn, String[] requiredBy, String[] tags, String description) { + private ExternalServiceResource withPipelineStepFactoryImpl(String stepName, AspireAction1 callback, String[] dependsOn, String[] requiredBy, String[] tags, String description) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("stepName", AspireClient.serializeValue(stepName)); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var arg = (PipelineStepContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } if (dependsOn != null) { reqArgs.put("dependsOn", AspireClient.serializeValue(dependsOn)); @@ -3119,41 +9050,40 @@ public IResource withPipelineStepFactory(String stepName, Function callback) { + public ExternalServiceResource withPipelineConfigurationAsync(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var arg = (PipelineConfigurationContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withPipelineConfigurationAsync", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withPipelineConfigurationAsync", reqArgs); + return this; } /** Configures pipeline step dependencies via a callback */ - public IResource withPipelineConfiguration(Function callback) { + public ExternalServiceResource withPipelineConfiguration(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withPipelineConfiguration", reqArgs); - } - - /** Adds a volume */ - public ContainerResource withVolume(String target, String name, Boolean isReadOnly) { - Map reqArgs = new HashMap<>(); - reqArgs.put("resource", AspireClient.serializeValue(getHandle())); - reqArgs.put("target", AspireClient.serializeValue(target)); - if (name != null) { - reqArgs.put("name", AspireClient.serializeValue(name)); + var callbackId = getClient().registerCallback(args -> { + var obj = (PipelineConfigurationContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - if (isReadOnly != null) { - reqArgs.put("isReadOnly", AspireClient.serializeValue(isReadOnly)); - } - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withVolume", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withPipelineConfiguration", reqArgs); + return this; } /** Gets the resource name */ @@ -3164,57 +9094,82 @@ public String getResourceName() { } /** Subscribes to the BeforeResourceStarted event */ - public IResource onBeforeResourceStarted(Function callback) { + public ExternalServiceResource onBeforeResourceStarted(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var arg = (BeforeResourceStartedEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onBeforeResourceStarted", reqArgs); + getClient().invokeCapability("Aspire.Hosting/onBeforeResourceStarted", reqArgs); + return this; } /** Subscribes to the ResourceStopped event */ - public IResource onResourceStopped(Function callback) { + public ExternalServiceResource onResourceStopped(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceStoppedEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onResourceStopped", reqArgs); + getClient().invokeCapability("Aspire.Hosting/onResourceStopped", reqArgs); + return this; } /** Subscribes to the InitializeResource event */ - public IResource onInitializeResource(Function callback) { + public ExternalServiceResource onInitializeResource(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var arg = (InitializeResourceEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onInitializeResource", reqArgs); + getClient().invokeCapability("Aspire.Hosting/onInitializeResource", reqArgs); + return this; } - /** Subscribes to the ResourceEndpointsAllocated event */ - public IResourceWithEndpoints onResourceEndpointsAllocated(Function callback) { + /** Subscribes to the ResourceReady event */ + public ExternalServiceResource onResourceReady(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceReadyEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/onResourceEndpointsAllocated", reqArgs); + getClient().invokeCapability("Aspire.Hosting/onResourceReady", reqArgs); + return this; } - /** Subscribes to the ResourceReady event */ - public IResource onResourceReady(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onResourceReady", reqArgs); + /** Adds an optional string parameter */ + public ExternalServiceResource withOptionalString(WithOptionalStringOptions options) { + var value = options == null ? null : options.getValue(); + var enabled = options == null ? null : options.getEnabled(); + return withOptionalStringImpl(value, enabled); + } + + public ExternalServiceResource withOptionalString() { + return withOptionalString(null); } /** Adds an optional string parameter */ - public IResource withOptionalString(String value, Boolean enabled) { + private ExternalServiceResource withOptionalStringImpl(String value, Boolean enabled) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); if (value != null) { @@ -3223,1952 +9178,1818 @@ public IResource withOptionalString(String value, Boolean enabled) { if (enabled != null) { reqArgs.put("enabled", AspireClient.serializeValue(enabled)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalString", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalString", reqArgs); + return this; } /** Configures the resource with a DTO */ - public IResource withConfig(TestConfigDto config) { + public ExternalServiceResource withConfig(TestConfigDto config) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("config", AspireClient.serializeValue(config)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConfig", reqArgs); - } - - /** Configures environment with callback (test version) */ - public IResourceWithEnvironment testWithEnvironmentCallback(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWithEnvironmentCallback", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConfig", reqArgs); + return this; } /** Sets the created timestamp */ - public IResource withCreatedAt(String createdAt) { + public ExternalServiceResource withCreatedAt(String createdAt) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("createdAt", AspireClient.serializeValue(createdAt)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCreatedAt", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCreatedAt", reqArgs); + return this; } /** Sets the modified timestamp */ - public IResource withModifiedAt(String modifiedAt) { + public ExternalServiceResource withModifiedAt(String modifiedAt) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("modifiedAt", AspireClient.serializeValue(modifiedAt)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withModifiedAt", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withModifiedAt", reqArgs); + return this; } /** Sets the correlation ID */ - public IResource withCorrelationId(String correlationId) { + public ExternalServiceResource withCorrelationId(String correlationId) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("correlationId", AspireClient.serializeValue(correlationId)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCorrelationId", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCorrelationId", reqArgs); + return this; + } + + public ExternalServiceResource withOptionalCallback() { + return withOptionalCallback(null); } /** Configures with optional callback */ - public IResource withOptionalCallback(Function callback) { + public ExternalServiceResource withOptionalCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = callback == null ? null : getClient().registerCallback(args -> { + var arg = (TestCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalCallback", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalCallback", reqArgs); + return this; } /** Sets the resource status */ - public IResource withStatus(TestResourceStatus status) { + public ExternalServiceResource withStatus(TestResourceStatus status) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("status", AspireClient.serializeValue(status)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withStatus", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withStatus", reqArgs); + return this; } /** Configures with nested DTO */ - public IResource withNestedConfig(TestNestedDto config) { + public ExternalServiceResource withNestedConfig(TestNestedDto config) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("config", AspireClient.serializeValue(config)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withNestedConfig", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withNestedConfig", reqArgs); + return this; } /** Adds validation callback */ - public IResource withValidator(Function validator) { + public ExternalServiceResource withValidator(AspireFunc1 validator) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (validator != null) { - reqArgs.put("validator", getClient().registerCallback(validator)); + var validatorId = getClient().registerCallback(args -> { + var arg = (TestResourceContext) args[0]; + return AspireClient.awaitValue(validator.invoke(arg)); + }); + if (validatorId != null) { + reqArgs.put("validator", validatorId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withValidator", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withValidator", reqArgs); + return this; } /** Waits for another resource (test version) */ - public IResource testWaitFor(IResource dependency) { + public ExternalServiceResource testWaitFor(IResource dependency) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWaitFor", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWaitFor", reqArgs); + return this; + } + + public ExternalServiceResource testWaitFor(ResourceBuilderBase dependency) { + return testWaitFor(new IResource(dependency.getHandle(), dependency.getClient())); } /** Adds a dependency on another resource */ - public IResource withDependency(IResourceWithConnectionString dependency) { + public ExternalServiceResource withDependency(IResourceWithConnectionString dependency) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDependency", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDependency", reqArgs); + return this; } - /** Sets the endpoints */ - public IResource withEndpoints(String[] endpoints) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("endpoints", AspireClient.serializeValue(endpoints)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEndpoints", reqArgs); + public ExternalServiceResource withDependency(ResourceBuilderBase dependency) { + return withDependency(new IResourceWithConnectionString(dependency.getHandle(), dependency.getClient())); } - /** Sets environment variables */ - public IResourceWithEnvironment withEnvironmentVariables(Map variables) { + /** Sets the endpoints */ + public ExternalServiceResource withEndpoints(String[] endpoints) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("variables", AspireClient.serializeValue(variables)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEnvironmentVariables", reqArgs); + reqArgs.put("endpoints", AspireClient.serializeValue(endpoints)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEndpoints", reqArgs); + return this; } /** Performs a cancellable operation */ - public IResource withCancellableOperation(Function operation) { + public ExternalServiceResource withCancellableOperation(AspireAction1 operation) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (operation != null) { - reqArgs.put("operation", getClient().registerCallback(operation)); + var operationId = getClient().registerCallback(args -> { + var arg = CancellationToken.fromValue(args[0]); + operation.invoke(arg); + return null; + }); + if (operationId != null) { + reqArgs.put("operation", operationId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCancellableOperation", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCancellableOperation", reqArgs); + return this; } } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.DistributedApplication. */ -class DistributedApplication extends HandleWrapperBase { - DistributedApplication(Handle handle, AspireClient client) { - super(handle, client); - } - - /** Runs the distributed application */ - public void run(CancellationToken cancellationToken) { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - if (cancellationToken != null) { - reqArgs.put("cancellationToken", getClient().registerCancellation(cancellationToken)); - } - getClient().invokeCapability("Aspire.Hosting/run", reqArgs); - } +// ===== Handle.java ===== +// Handle.java - GENERATED CODE - DO NOT EDIT -} +package aspire; -/** Wrapper for Aspire.Hosting/Aspire.Hosting.Eventing.DistributedApplicationEventSubscription. */ -class DistributedApplicationEventSubscription extends HandleWrapperBase { - DistributedApplicationEventSubscription(Handle handle, AspireClient client) { - super(handle, client); - } +import java.io.*; +import java.net.*; +import java.nio.charset.StandardCharsets; +import java.util.*; +import java.util.concurrent.*; +import java.util.concurrent.atomic.*; +import java.util.function.*; -} +/** + * Handle represents a remote object reference. + */ +public class Handle { + private final String id; + private final String typeId; -/** Wrapper for Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext. */ -class DistributedApplicationExecutionContext extends HandleWrapperBase { - DistributedApplicationExecutionContext(Handle handle, AspireClient client) { - super(handle, client); + Handle(String id, String typeId) { + this.id = id; + this.typeId = typeId; } - /** Gets the PublisherName property */ - public String publisherName() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (String) getClient().invokeCapability("Aspire.Hosting/DistributedApplicationExecutionContext.publisherName", reqArgs); - } + String getId() { return id; } + String getTypeId() { return typeId; } - /** Sets the PublisherName property */ - public DistributedApplicationExecutionContext setPublisherName(String value) { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (DistributedApplicationExecutionContext) getClient().invokeCapability("Aspire.Hosting/DistributedApplicationExecutionContext.setPublisherName", reqArgs); + Map toJson() { + Map result = new HashMap<>(); + result.put("$handle", id); + result.put("$type", typeId); + return result; } - /** Gets the Operation property */ - public DistributedApplicationOperation operation() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (DistributedApplicationOperation) getClient().invokeCapability("Aspire.Hosting/DistributedApplicationExecutionContext.operation", reqArgs); + @Override + public String toString() { + return "Handle{id='" + id + "', typeId='" + typeId + "'}"; } +} - /** Gets the ServiceProvider property */ - public IServiceProvider serviceProvider() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (IServiceProvider) getClient().invokeCapability("Aspire.Hosting/DistributedApplicationExecutionContext.serviceProvider", reqArgs); - } +// ===== HandleWrapperBase.java ===== +// HandleWrapperBase.java - GENERATED CODE - DO NOT EDIT - /** Gets the IsPublishMode property */ - public boolean isPublishMode() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (boolean) getClient().invokeCapability("Aspire.Hosting/DistributedApplicationExecutionContext.isPublishMode", reqArgs); - } +package aspire; - /** Gets the IsRunMode property */ - public boolean isRunMode() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (boolean) getClient().invokeCapability("Aspire.Hosting/DistributedApplicationExecutionContext.isRunMode", reqArgs); - } +import java.util.*; -} +/** + * HandleWrapperBase is the base class for all handle wrappers. + */ +public class HandleWrapperBase { + private final Handle handle; + private final AspireClient client; -/** Wrapper for Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContextOptions. */ -class DistributedApplicationExecutionContextOptions extends HandleWrapperBase { - DistributedApplicationExecutionContextOptions(Handle handle, AspireClient client) { - super(handle, client); + HandleWrapperBase(Handle handle, AspireClient client) { + this.handle = handle; + this.client = client; } -} - -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel. */ -class DistributedApplicationModel extends HandleWrapperBase { - DistributedApplicationModel(Handle handle, AspireClient client) { - super(handle, client); + Handle getHandle() { + return handle; } - /** Gets resources from the distributed application model */ - public IResource[] getResources() { - Map reqArgs = new HashMap<>(); - reqArgs.put("model", AspireClient.serializeValue(getHandle())); - return (IResource[]) getClient().invokeCapability("Aspire.Hosting/getResources", reqArgs); + AspireClient getClient() { + return client; } +} - /** Finds a resource by name */ - public IResource findResourceByName(String name) { - Map reqArgs = new HashMap<>(); - reqArgs.put("model", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/findResourceByName", reqArgs); - } +// ===== IComputeResource.java ===== +// IComputeResource.java - GENERATED CODE - DO NOT EDIT -} +package aspire; -/** Wrapper for Aspire.Hosting/Aspire.Hosting.Eventing.DistributedApplicationResourceEventSubscription. */ -class DistributedApplicationResourceEventSubscription extends HandleWrapperBase { - DistributedApplicationResourceEventSubscription(Handle handle, AspireClient client) { +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource. */ +public class IComputeResource extends HandleWrapperBase { + IComputeResource(Handle handle, AspireClient client) { super(handle, client); } } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource. */ -class DotnetToolResource extends ResourceBuilderBase { - DotnetToolResource(Handle handle, AspireClient client) { +// ===== IConfiguration.java ===== +// IConfiguration.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration. */ +public class IConfiguration extends HandleWrapperBase { + IConfiguration(Handle handle, AspireClient client) { super(handle, client); } - /** Configures a resource to use a container registry */ - public IResource withContainerRegistry(IResource registry) { + /** Gets a configuration value by key */ + public String getConfigValue(String key) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("registry", AspireClient.serializeValue(registry)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withContainerRegistry", reqArgs); + reqArgs.put("configuration", AspireClient.serializeValue(getHandle())); + reqArgs.put("key", AspireClient.serializeValue(key)); + return (String) getClient().invokeCapability("Aspire.Hosting/getConfigValue", reqArgs); } - /** Sets the base image for a Dockerfile build */ - public IResource withDockerfileBaseImage(String buildImage, String runtimeImage) { + /** Gets a connection string by name */ + public String getConnectionString(String name) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (buildImage != null) { - reqArgs.put("buildImage", AspireClient.serializeValue(buildImage)); - } - if (runtimeImage != null) { - reqArgs.put("runtimeImage", AspireClient.serializeValue(runtimeImage)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withDockerfileBaseImage", reqArgs); + reqArgs.put("configuration", AspireClient.serializeValue(getHandle())); + reqArgs.put("name", AspireClient.serializeValue(name)); + return (String) getClient().invokeCapability("Aspire.Hosting/getConnectionString", reqArgs); } - /** Sets the tool package ID */ - public DotnetToolResource withToolPackage(String packageId) { + /** Gets a configuration section by key */ + public IConfigurationSection getSection(String key) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("packageId", AspireClient.serializeValue(packageId)); - return (DotnetToolResource) getClient().invokeCapability("Aspire.Hosting/withToolPackage", reqArgs); + reqArgs.put("configuration", AspireClient.serializeValue(getHandle())); + reqArgs.put("key", AspireClient.serializeValue(key)); + return (IConfigurationSection) getClient().invokeCapability("Aspire.Hosting/getSection", reqArgs); } - /** Sets the tool version */ - public DotnetToolResource withToolVersion(String version) { + /** Gets child configuration sections */ + public IConfigurationSection[] getChildren() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("version", AspireClient.serializeValue(version)); - return (DotnetToolResource) getClient().invokeCapability("Aspire.Hosting/withToolVersion", reqArgs); + reqArgs.put("configuration", AspireClient.serializeValue(getHandle())); + return (IConfigurationSection[]) getClient().invokeCapability("Aspire.Hosting/getChildren", reqArgs); } - /** Allows prerelease tool versions */ - public DotnetToolResource withToolPrerelease() { + /** Checks whether a configuration section exists */ + public boolean exists(String key) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (DotnetToolResource) getClient().invokeCapability("Aspire.Hosting/withToolPrerelease", reqArgs); + reqArgs.put("configuration", AspireClient.serializeValue(getHandle())); + reqArgs.put("key", AspireClient.serializeValue(key)); + return (boolean) getClient().invokeCapability("Aspire.Hosting/exists", reqArgs); } - /** Adds a NuGet source for the tool */ - public DotnetToolResource withToolSource(String source) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("source", AspireClient.serializeValue(source)); - return (DotnetToolResource) getClient().invokeCapability("Aspire.Hosting/withToolSource", reqArgs); +} + +// ===== IConfigurationSection.java ===== +// IConfigurationSection.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfigurationSection. */ +public class IConfigurationSection extends HandleWrapperBase { + IConfigurationSection(Handle handle, AspireClient client) { + super(handle, client); } - /** Ignores existing NuGet feeds */ - public DotnetToolResource withToolIgnoreExistingFeeds() { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (DotnetToolResource) getClient().invokeCapability("Aspire.Hosting/withToolIgnoreExistingFeeds", reqArgs); +} + +// ===== IContainerFilesDestinationResource.java ===== +// IContainerFilesDestinationResource.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource. */ +public class IContainerFilesDestinationResource extends HandleWrapperBase { + IContainerFilesDestinationResource(Handle handle, AspireClient client) { + super(handle, client); } - /** Ignores failed NuGet sources */ - public DotnetToolResource withToolIgnoreFailedSources() { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (DotnetToolResource) getClient().invokeCapability("Aspire.Hosting/withToolIgnoreFailedSources", reqArgs); +} + +// ===== IDistributedApplicationBuilder.java ===== +// IDistributedApplicationBuilder.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder. */ +public class IDistributedApplicationBuilder extends HandleWrapperBase { + IDistributedApplicationBuilder(Handle handle, AspireClient client) { + super(handle, client); } - /** Publishes the executable as a Docker container */ - public ExecutableResource publishAsDockerFile() { + /** Adds a connection string with a reference expression */ + public ConnectionStringResource addConnectionStringExpression(String name, ReferenceExpression connectionStringExpression) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (ExecutableResource) getClient().invokeCapability("Aspire.Hosting/publishAsDockerFile", reqArgs); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("connectionStringExpression", AspireClient.serializeValue(connectionStringExpression)); + return (ConnectionStringResource) getClient().invokeCapability("Aspire.Hosting/addConnectionStringExpression", reqArgs); } - /** Publishes an executable as a Docker file with optional container configuration */ - public ExecutableResource publishAsDockerFileWithConfigure(Function configure) { + /** Adds a connection string with a builder callback */ + public ConnectionStringResource addConnectionStringBuilder(String name, AspireAction1 connectionStringBuilder) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (configure != null) { - reqArgs.put("configure", getClient().registerCallback(configure)); + reqArgs.put("name", AspireClient.serializeValue(name)); + var connectionStringBuilderId = getClient().registerCallback(args -> { + var obj = (ReferenceExpressionBuilder) args[0]; + connectionStringBuilder.invoke(obj); + return null; + }); + if (connectionStringBuilderId != null) { + reqArgs.put("connectionStringBuilder", connectionStringBuilderId); } - return (ExecutableResource) getClient().invokeCapability("Aspire.Hosting/publishAsDockerFileWithConfigure", reqArgs); + return (ConnectionStringResource) getClient().invokeCapability("Aspire.Hosting/addConnectionStringBuilder", reqArgs); } - /** Sets the executable command */ - public ExecutableResource withExecutableCommand(String command) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("command", AspireClient.serializeValue(command)); - return (ExecutableResource) getClient().invokeCapability("Aspire.Hosting/withExecutableCommand", reqArgs); + public ContainerRegistryResource addContainerRegistry(String name, ParameterResource endpoint) { + return addContainerRegistry(name, endpoint, null); } - /** Sets the executable working directory */ - public ExecutableResource withWorkingDirectory(String workingDirectory) { + /** Adds a container registry resource */ + public ContainerRegistryResource addContainerRegistry(String name, ParameterResource endpoint, ParameterResource repository) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("workingDirectory", AspireClient.serializeValue(workingDirectory)); - return (ExecutableResource) getClient().invokeCapability("Aspire.Hosting/withWorkingDirectory", reqArgs); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("endpoint", AspireClient.serializeValue(endpoint)); + if (repository != null) { + reqArgs.put("repository", AspireClient.serializeValue(repository)); + } + return (ContainerRegistryResource) getClient().invokeCapability("Aspire.Hosting/addContainerRegistry", reqArgs); } - /** Configures an MCP server endpoint on the resource */ - public IResourceWithEndpoints withMcpServer(String path, String endpointName) { + public ContainerRegistryResource addContainerRegistryFromString(String name, String endpoint) { + return addContainerRegistryFromString(name, endpoint, null); + } + + /** Adds a container registry with string endpoint */ + public ContainerRegistryResource addContainerRegistryFromString(String name, String endpoint, String repository) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (path != null) { - reqArgs.put("path", AspireClient.serializeValue(path)); - } - if (endpointName != null) { - reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("endpoint", AspireClient.serializeValue(endpoint)); + if (repository != null) { + reqArgs.put("repository", AspireClient.serializeValue(repository)); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withMcpServer", reqArgs); + return (ContainerRegistryResource) getClient().invokeCapability("Aspire.Hosting/addContainerRegistryFromString", reqArgs); } - /** Configures OTLP telemetry export */ - public IResourceWithEnvironment withOtlpExporter() { + /** Adds a container resource */ + public ContainerResource addContainer(String name, String image) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withOtlpExporter", reqArgs); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("image", AspireClient.serializeValue(image)); + return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/addContainer", reqArgs); } - /** Configures OTLP telemetry export with specific protocol */ - public IResourceWithEnvironment withOtlpExporterProtocol(OtlpProtocol protocol) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("protocol", AspireClient.serializeValue(protocol)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withOtlpExporterProtocol", reqArgs); + /** Adds a container resource built from a Dockerfile */ + public ContainerResource addDockerfile(String name, String contextPath, AddDockerfileOptions options) { + var dockerfilePath = options == null ? null : options.getDockerfilePath(); + var stage = options == null ? null : options.getStage(); + return addDockerfileImpl(name, contextPath, dockerfilePath, stage); } - /** Adds a required command dependency */ - public IResource withRequiredCommand(String command, String helpLink) { + public ContainerResource addDockerfile(String name, String contextPath) { + return addDockerfile(name, contextPath, null); + } + + /** Adds a container resource built from a Dockerfile */ + private ContainerResource addDockerfileImpl(String name, String contextPath, String dockerfilePath, String stage) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("command", AspireClient.serializeValue(command)); - if (helpLink != null) { - reqArgs.put("helpLink", AspireClient.serializeValue(helpLink)); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("contextPath", AspireClient.serializeValue(contextPath)); + if (dockerfilePath != null) { + reqArgs.put("dockerfilePath", AspireClient.serializeValue(dockerfilePath)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withRequiredCommand", reqArgs); + if (stage != null) { + reqArgs.put("stage", AspireClient.serializeValue(stage)); + } + return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/addDockerfile", reqArgs); } - /** Sets an environment variable */ - public IResourceWithEnvironment withEnvironment(String name, String value) { + /** Adds a .NET tool resource */ + public DotnetToolResource addDotnetTool(String name, String packageId) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironment", reqArgs); + reqArgs.put("packageId", AspireClient.serializeValue(packageId)); + return (DotnetToolResource) getClient().invokeCapability("Aspire.Hosting/addDotnetTool", reqArgs); } - /** Adds an environment variable with a reference expression */ - public IResourceWithEnvironment withEnvironmentExpression(String name, ReferenceExpression value) { + /** Adds an executable resource */ + public ExecutableResource addExecutable(String name, String command, String workingDirectory, String[] args) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentExpression", reqArgs); + reqArgs.put("command", AspireClient.serializeValue(command)); + reqArgs.put("workingDirectory", AspireClient.serializeValue(workingDirectory)); + reqArgs.put("args", AspireClient.serializeValue(args)); + return (ExecutableResource) getClient().invokeCapability("Aspire.Hosting/addExecutable", reqArgs); } - /** Sets environment variables via callback */ - public IResourceWithEnvironment withEnvironmentCallback(Function callback) { + /** Adds an external service resource */ + public ExternalServiceResource addExternalService(String name, String url) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentCallback", reqArgs); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("url", AspireClient.serializeValue(url)); + return (ExternalServiceResource) getClient().invokeCapability("Aspire.Hosting/addExternalService", reqArgs); } - /** Sets environment variables via async callback */ - public IResourceWithEnvironment withEnvironmentCallbackAsync(Function callback) { + /** Adds an external service with a URI */ + public ExternalServiceResource addExternalServiceUri(String name, String uri) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentCallbackAsync", reqArgs); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("uri", AspireClient.serializeValue(uri)); + return (ExternalServiceResource) getClient().invokeCapability("Aspire.Hosting/addExternalServiceUri", reqArgs); } - /** Sets an environment variable from an endpoint reference */ - public IResourceWithEnvironment withEnvironmentEndpoint(String name, EndpointReference endpointReference) { + /** Adds an external service with a parameter URL */ + public ExternalServiceResource addExternalServiceParameter(String name, ParameterResource urlParameter) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("endpointReference", AspireClient.serializeValue(endpointReference)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentEndpoint", reqArgs); + reqArgs.put("urlParameter", AspireClient.serializeValue(urlParameter)); + return (ExternalServiceResource) getClient().invokeCapability("Aspire.Hosting/addExternalServiceParameter", reqArgs); } - /** Sets an environment variable from a parameter resource */ - public IResourceWithEnvironment withEnvironmentParameter(String name, ParameterResource parameter) { + /** Gets the AppHostDirectory property */ + public String appHostDirectory() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("parameter", AspireClient.serializeValue(parameter)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentParameter", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (String) getClient().invokeCapability("Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory", reqArgs); } - /** Sets an environment variable from a connection string resource */ - public IResourceWithEnvironment withEnvironmentConnectionString(String envVarName, IResourceWithConnectionString resource) { + /** Gets the Environment property */ + public IHostEnvironment environment() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("envVarName", AspireClient.serializeValue(envVarName)); - reqArgs.put("resource", AspireClient.serializeValue(resource)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentConnectionString", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (IHostEnvironment) getClient().invokeCapability("Aspire.Hosting/IDistributedApplicationBuilder.environment", reqArgs); } - /** Adds arguments */ - public IResourceWithArgs withArgs(String[] args) { + /** Gets the Eventing property */ + public IDistributedApplicationEventing eventing() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("args", AspireClient.serializeValue(args)); - return (IResourceWithArgs) getClient().invokeCapability("Aspire.Hosting/withArgs", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (IDistributedApplicationEventing) getClient().invokeCapability("Aspire.Hosting/IDistributedApplicationBuilder.eventing", reqArgs); } - /** Sets command-line arguments via callback */ - public IResourceWithArgs withArgsCallback(Function callback) { + /** Gets the ExecutionContext property */ + public DistributedApplicationExecutionContext executionContext() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResourceWithArgs) getClient().invokeCapability("Aspire.Hosting/withArgsCallback", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (DistributedApplicationExecutionContext) getClient().invokeCapability("Aspire.Hosting/IDistributedApplicationBuilder.executionContext", reqArgs); } - /** Sets command-line arguments via async callback */ - public IResourceWithArgs withArgsCallbackAsync(Function callback) { + /** Gets the UserSecretsManager property */ + public IUserSecretsManager userSecretsManager() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResourceWithArgs) getClient().invokeCapability("Aspire.Hosting/withArgsCallbackAsync", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (IUserSecretsManager) getClient().invokeCapability("Aspire.Hosting/IDistributedApplicationBuilder.userSecretsManager", reqArgs); } - /** Adds a reference to another resource */ - public IResourceWithEnvironment withReference(IResource source, String connectionName, Boolean optional, String name) { + /** Builds the distributed application */ + public DistributedApplication build() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("source", AspireClient.serializeValue(source)); - if (connectionName != null) { - reqArgs.put("connectionName", AspireClient.serializeValue(connectionName)); - } - if (optional != null) { - reqArgs.put("optional", AspireClient.serializeValue(optional)); - } - if (name != null) { - reqArgs.put("name", AspireClient.serializeValue(name)); - } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withReference", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (DistributedApplication) getClient().invokeCapability("Aspire.Hosting/build", reqArgs); } - /** Adds a reference to a URI */ - public IResourceWithEnvironment withReferenceUri(String name, String uri) { + public ParameterResource addParameter(String name) { + return addParameter(name, null); + } + + /** Adds a parameter resource */ + public ParameterResource addParameter(String name, Boolean secret) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("uri", AspireClient.serializeValue(uri)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withReferenceUri", reqArgs); + if (secret != null) { + reqArgs.put("secret", AspireClient.serializeValue(secret)); + } + return (ParameterResource) getClient().invokeCapability("Aspire.Hosting/addParameter", reqArgs); } - /** Adds a reference to an external service */ - public IResourceWithEnvironment withReferenceExternalService(ExternalServiceResource externalService) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("externalService", AspireClient.serializeValue(externalService)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withReferenceExternalService", reqArgs); + /** Adds a parameter with a default value */ + public ParameterResource addParameterWithValue(String name, String value, AddParameterWithValueOptions options) { + var publishValueAsDefault = options == null ? null : options.getPublishValueAsDefault(); + var secret = options == null ? null : options.getSecret(); + return addParameterWithValueImpl(name, value, publishValueAsDefault, secret); } - /** Adds a reference to an endpoint */ - public IResourceWithEnvironment withReferenceEndpoint(EndpointReference endpointReference) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("endpointReference", AspireClient.serializeValue(endpointReference)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withReferenceEndpoint", reqArgs); + public ParameterResource addParameterWithValue(String name, String value) { + return addParameterWithValue(name, value, null); } - /** Adds a network endpoint */ - public IResourceWithEndpoints withEndpoint(Double port, Double targetPort, String scheme, String name, String env, Boolean isProxied, Boolean isExternal, ProtocolType protocol) { + /** Adds a parameter with a default value */ + private ParameterResource addParameterWithValueImpl(String name, String value, Boolean publishValueAsDefault, Boolean secret) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (port != null) { - reqArgs.put("port", AspireClient.serializeValue(port)); - } - if (targetPort != null) { - reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); - } - if (scheme != null) { - reqArgs.put("scheme", AspireClient.serializeValue(scheme)); - } - if (name != null) { - reqArgs.put("name", AspireClient.serializeValue(name)); - } - if (env != null) { - reqArgs.put("env", AspireClient.serializeValue(env)); - } - if (isProxied != null) { - reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); - } - if (isExternal != null) { - reqArgs.put("isExternal", AspireClient.serializeValue(isExternal)); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("value", AspireClient.serializeValue(value)); + if (publishValueAsDefault != null) { + reqArgs.put("publishValueAsDefault", AspireClient.serializeValue(publishValueAsDefault)); } - if (protocol != null) { - reqArgs.put("protocol", AspireClient.serializeValue(protocol)); + if (secret != null) { + reqArgs.put("secret", AspireClient.serializeValue(secret)); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withEndpoint", reqArgs); + return (ParameterResource) getClient().invokeCapability("Aspire.Hosting/addParameterWithValue", reqArgs); } - /** Adds an HTTP endpoint */ - public IResourceWithEndpoints withHttpEndpoint(Double port, Double targetPort, String name, String env, Boolean isProxied) { + public ParameterResource addParameterFromConfiguration(String name, String configurationKey) { + return addParameterFromConfiguration(name, configurationKey, null); + } + + /** Adds a parameter sourced from configuration */ + public ParameterResource addParameterFromConfiguration(String name, String configurationKey, Boolean secret) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (port != null) { - reqArgs.put("port", AspireClient.serializeValue(port)); - } - if (targetPort != null) { - reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); - } - if (name != null) { - reqArgs.put("name", AspireClient.serializeValue(name)); - } - if (env != null) { - reqArgs.put("env", AspireClient.serializeValue(env)); - } - if (isProxied != null) { - reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("configurationKey", AspireClient.serializeValue(configurationKey)); + if (secret != null) { + reqArgs.put("secret", AspireClient.serializeValue(secret)); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withHttpEndpoint", reqArgs); + return (ParameterResource) getClient().invokeCapability("Aspire.Hosting/addParameterFromConfiguration", reqArgs); } - /** Adds an HTTPS endpoint */ - public IResourceWithEndpoints withHttpsEndpoint(Double port, Double targetPort, String name, String env, Boolean isProxied) { + public IResourceWithConnectionString addConnectionString(String name) { + return addConnectionString(name, null); + } + + /** Adds a connection string resource */ + public IResourceWithConnectionString addConnectionString(String name, String environmentVariableName) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (port != null) { - reqArgs.put("port", AspireClient.serializeValue(port)); - } - if (targetPort != null) { - reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); - } - if (name != null) { - reqArgs.put("name", AspireClient.serializeValue(name)); - } - if (env != null) { - reqArgs.put("env", AspireClient.serializeValue(env)); - } - if (isProxied != null) { - reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); + reqArgs.put("name", AspireClient.serializeValue(name)); + if (environmentVariableName != null) { + reqArgs.put("environmentVariableName", AspireClient.serializeValue(environmentVariableName)); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withHttpsEndpoint", reqArgs); + return (IResourceWithConnectionString) getClient().invokeCapability("Aspire.Hosting/addConnectionString", reqArgs); } - /** Makes HTTP endpoints externally accessible */ - public IResourceWithEndpoints withExternalHttpEndpoints() { + /** Adds a .NET project resource */ + public ProjectResource addProject(String name, String projectPath, String launchProfileName) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withExternalHttpEndpoints", reqArgs); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("projectPath", AspireClient.serializeValue(projectPath)); + reqArgs.put("launchProfileName", AspireClient.serializeValue(launchProfileName)); + return (ProjectResource) getClient().invokeCapability("Aspire.Hosting/addProject", reqArgs); } - /** Gets an endpoint reference */ - public EndpointReference getEndpoint(String name) { + /** Adds a project resource with configuration options */ + public ProjectResource addProjectWithOptions(String name, String projectPath, AspireAction1 configure) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("name", AspireClient.serializeValue(name)); - return (EndpointReference) getClient().invokeCapability("Aspire.Hosting/getEndpoint", reqArgs); + reqArgs.put("projectPath", AspireClient.serializeValue(projectPath)); + var configureId = getClient().registerCallback(args -> { + var obj = (ProjectResourceOptions) args[0]; + configure.invoke(obj); + return null; + }); + if (configureId != null) { + reqArgs.put("configure", configureId); + } + return (ProjectResource) getClient().invokeCapability("Aspire.Hosting/addProjectWithOptions", reqArgs); } - /** Configures resource for HTTP/2 */ - public IResourceWithEndpoints asHttp2Service() { + /** Adds a C# application resource */ + public ProjectResource addCSharpApp(String name, String path) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/asHttp2Service", reqArgs); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("path", AspireClient.serializeValue(path)); + return (ProjectResource) getClient().invokeCapability("Aspire.Hosting/addCSharpApp", reqArgs); } - /** Customizes displayed URLs via callback */ - public IResource withUrlsCallback(Function callback) { + /** Adds a C# application resource with configuration options */ + public CSharpAppResource addCSharpAppWithOptions(String name, String path, AspireAction1 configure) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("path", AspireClient.serializeValue(path)); + var configureId = getClient().registerCallback(args -> { + var obj = (ProjectResourceOptions) args[0]; + configure.invoke(obj); + return null; + }); + if (configureId != null) { + reqArgs.put("configure", configureId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlsCallback", reqArgs); + return (CSharpAppResource) getClient().invokeCapability("Aspire.Hosting/addCSharpAppWithOptions", reqArgs); } - /** Customizes displayed URLs via async callback */ - public IResource withUrlsCallbackAsync(Function callback) { + /** Gets the application configuration */ + public IConfiguration getConfiguration() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlsCallbackAsync", reqArgs); + return (IConfiguration) getClient().invokeCapability("Aspire.Hosting/getConfiguration", reqArgs); } - /** Adds or modifies displayed URLs */ - public IResource withUrl(String url, String displayText) { + /** Subscribes to the BeforeStart event */ + public DistributedApplicationEventSubscription subscribeBeforeStart(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("url", AspireClient.serializeValue(url)); - if (displayText != null) { - reqArgs.put("displayText", AspireClient.serializeValue(displayText)); + var callbackId = getClient().registerCallback(args -> { + var arg = (BeforeStartEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrl", reqArgs); + return (DistributedApplicationEventSubscription) getClient().invokeCapability("Aspire.Hosting/subscribeBeforeStart", reqArgs); } - /** Adds a URL using a reference expression */ - public IResource withUrlExpression(ReferenceExpression url, String displayText) { + /** Subscribes to the AfterResourcesCreated event */ + public DistributedApplicationEventSubscription subscribeAfterResourcesCreated(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("url", AspireClient.serializeValue(url)); - if (displayText != null) { - reqArgs.put("displayText", AspireClient.serializeValue(displayText)); + var callbackId = getClient().registerCallback(args -> { + var arg = (AfterResourcesCreatedEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlExpression", reqArgs); + return (DistributedApplicationEventSubscription) getClient().invokeCapability("Aspire.Hosting/subscribeAfterResourcesCreated", reqArgs); } - /** Customizes the URL for a specific endpoint via callback */ - public IResource withUrlForEndpoint(String endpointName, Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlForEndpoint", reqArgs); + public TestRedisResource addTestRedis(String name) { + return addTestRedis(name, null); } - /** Adds a URL for a specific endpoint via factory callback */ - public IResourceWithEndpoints withUrlForEndpointFactory(String endpointName, Function callback) { + /** Adds a test Redis resource */ + public TestRedisResource addTestRedis(String name, Double port) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + reqArgs.put("name", AspireClient.serializeValue(name)); + if (port != null) { + reqArgs.put("port", AspireClient.serializeValue(port)); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withUrlForEndpointFactory", reqArgs); + return (TestRedisResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/addTestRedis", reqArgs); } - /** Excludes the resource from the deployment manifest */ - public IResource excludeFromManifest() { + /** Adds a test vault resource */ + public TestVaultResource addTestVault(String name) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/excludeFromManifest", reqArgs); + reqArgs.put("name", AspireClient.serializeValue(name)); + return (TestVaultResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/addTestVault", reqArgs); } - /** Waits for another resource to be ready */ - public IResourceWithWaitSupport waitFor(IResource dependency) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitFor", reqArgs); - } +} - /** Waits for another resource with specific behavior */ - public IResourceWithWaitSupport waitForWithBehavior(IResource dependency, WaitBehavior waitBehavior) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - reqArgs.put("waitBehavior", AspireClient.serializeValue(waitBehavior)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForWithBehavior", reqArgs); +// ===== IDistributedApplicationEvent.java ===== +// IDistributedApplicationEvent.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEvent. */ +public class IDistributedApplicationEvent extends HandleWrapperBase { + IDistributedApplicationEvent(Handle handle, AspireClient client) { + super(handle, client); } - /** Waits for another resource to start */ - public IResourceWithWaitSupport waitForStart(IResource dependency) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForStart", reqArgs); +} + +// ===== IDistributedApplicationEventing.java ===== +// IDistributedApplicationEventing.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing. */ +public class IDistributedApplicationEventing extends HandleWrapperBase { + IDistributedApplicationEventing(Handle handle, AspireClient client) { + super(handle, client); } - /** Waits for another resource to start with specific behavior */ - public IResourceWithWaitSupport waitForStartWithBehavior(IResource dependency, WaitBehavior waitBehavior) { + /** Invokes the Unsubscribe method */ + public void unsubscribe(DistributedApplicationEventSubscription subscription) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - reqArgs.put("waitBehavior", AspireClient.serializeValue(waitBehavior)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForStartWithBehavior", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + reqArgs.put("subscription", AspireClient.serializeValue(subscription)); + getClient().invokeCapability("Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe", reqArgs); } - /** Prevents resource from starting automatically */ - public IResource withExplicitStart() { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withExplicitStart", reqArgs); +} + +// ===== IDistributedApplicationResourceEvent.java ===== +// IDistributedApplicationResourceEvent.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationResourceEvent. */ +public class IDistributedApplicationResourceEvent extends HandleWrapperBase { + IDistributedApplicationResourceEvent(Handle handle, AspireClient client) { + super(handle, client); } - /** Waits for resource completion */ - public IResourceWithWaitSupport waitForCompletion(IResource dependency, Double exitCode) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - if (exitCode != null) { - reqArgs.put("exitCode", AspireClient.serializeValue(exitCode)); - } - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForCompletion", reqArgs); +} + +// ===== IHostEnvironment.java ===== +// IHostEnvironment.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment. */ +public class IHostEnvironment extends HandleWrapperBase { + IHostEnvironment(Handle handle, AspireClient client) { + super(handle, client); } - /** Adds a health check by key */ - public IResource withHealthCheck(String key) { + /** Checks if running in Development environment */ + public boolean isDevelopment() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("key", AspireClient.serializeValue(key)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withHealthCheck", reqArgs); + reqArgs.put("environment", AspireClient.serializeValue(getHandle())); + return (boolean) getClient().invokeCapability("Aspire.Hosting/isDevelopment", reqArgs); } - /** Adds an HTTP health check */ - public IResourceWithEndpoints withHttpHealthCheck(String path, Double statusCode, String endpointName) { + /** Checks if running in Production environment */ + public boolean isProduction() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (path != null) { - reqArgs.put("path", AspireClient.serializeValue(path)); - } - if (statusCode != null) { - reqArgs.put("statusCode", AspireClient.serializeValue(statusCode)); - } - if (endpointName != null) { - reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); - } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withHttpHealthCheck", reqArgs); + reqArgs.put("environment", AspireClient.serializeValue(getHandle())); + return (boolean) getClient().invokeCapability("Aspire.Hosting/isProduction", reqArgs); } - /** Adds a resource command */ - public IResource withCommand(String name, String displayName, Function executeCommand, CommandOptions commandOptions) { + /** Checks if running in Staging environment */ + public boolean isStaging() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("displayName", AspireClient.serializeValue(displayName)); - if (executeCommand != null) { - reqArgs.put("executeCommand", getClient().registerCallback(executeCommand)); - } - if (commandOptions != null) { - reqArgs.put("commandOptions", AspireClient.serializeValue(commandOptions)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withCommand", reqArgs); + reqArgs.put("environment", AspireClient.serializeValue(getHandle())); + return (boolean) getClient().invokeCapability("Aspire.Hosting/isStaging", reqArgs); } - /** Configures developer certificate trust */ - public IResourceWithEnvironment withDeveloperCertificateTrust(boolean trust) { + /** Checks if the environment matches the specified name */ + public boolean isEnvironment(String environmentName) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("trust", AspireClient.serializeValue(trust)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withDeveloperCertificateTrust", reqArgs); + reqArgs.put("environment", AspireClient.serializeValue(getHandle())); + reqArgs.put("environmentName", AspireClient.serializeValue(environmentName)); + return (boolean) getClient().invokeCapability("Aspire.Hosting/isEnvironment", reqArgs); } - /** Sets the certificate trust scope */ - public IResourceWithEnvironment withCertificateTrustScope(CertificateTrustScope scope) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("scope", AspireClient.serializeValue(scope)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withCertificateTrustScope", reqArgs); +} + +// ===== ILogger.java ===== +// ILogger.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger. */ +public class ILogger extends HandleWrapperBase { + ILogger(Handle handle, AspireClient client) { + super(handle, client); } - /** Configures HTTPS with a developer certificate */ - public IResourceWithEnvironment withHttpsDeveloperCertificate(ParameterResource password) { + /** Logs an information message */ + public void logInformation(String message) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (password != null) { - reqArgs.put("password", AspireClient.serializeValue(password)); - } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withHttpsDeveloperCertificate", reqArgs); + reqArgs.put("logger", AspireClient.serializeValue(getHandle())); + reqArgs.put("message", AspireClient.serializeValue(message)); + getClient().invokeCapability("Aspire.Hosting/logInformation", reqArgs); } - /** Removes HTTPS certificate configuration */ - public IResourceWithEnvironment withoutHttpsCertificate() { + /** Logs a warning message */ + public void logWarning(String message) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withoutHttpsCertificate", reqArgs); + reqArgs.put("logger", AspireClient.serializeValue(getHandle())); + reqArgs.put("message", AspireClient.serializeValue(message)); + getClient().invokeCapability("Aspire.Hosting/logWarning", reqArgs); } - /** Sets the parent relationship */ - public IResource withParentRelationship(IResource parent) { + /** Logs an error message */ + public void logError(String message) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("parent", AspireClient.serializeValue(parent)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withParentRelationship", reqArgs); + reqArgs.put("logger", AspireClient.serializeValue(getHandle())); + reqArgs.put("message", AspireClient.serializeValue(message)); + getClient().invokeCapability("Aspire.Hosting/logError", reqArgs); } - /** Sets a child relationship */ - public IResource withChildRelationship(IResource child) { + /** Logs a debug message */ + public void logDebug(String message) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("child", AspireClient.serializeValue(child)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withChildRelationship", reqArgs); + reqArgs.put("logger", AspireClient.serializeValue(getHandle())); + reqArgs.put("message", AspireClient.serializeValue(message)); + getClient().invokeCapability("Aspire.Hosting/logDebug", reqArgs); } - /** Sets the icon for the resource */ - public IResource withIconName(String iconName, IconVariant iconVariant) { + /** Logs a message with specified level */ + public void log(String level, String message) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("iconName", AspireClient.serializeValue(iconName)); - if (iconVariant != null) { - reqArgs.put("iconVariant", AspireClient.serializeValue(iconVariant)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withIconName", reqArgs); + reqArgs.put("logger", AspireClient.serializeValue(getHandle())); + reqArgs.put("level", AspireClient.serializeValue(level)); + reqArgs.put("message", AspireClient.serializeValue(message)); + getClient().invokeCapability("Aspire.Hosting/log", reqArgs); } - /** Adds an HTTP health probe to the resource */ - public IResourceWithEndpoints withHttpProbe(ProbeType probeType, String path, Double initialDelaySeconds, Double periodSeconds, Double timeoutSeconds, Double failureThreshold, Double successThreshold, String endpointName) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("probeType", AspireClient.serializeValue(probeType)); - if (path != null) { - reqArgs.put("path", AspireClient.serializeValue(path)); - } - if (initialDelaySeconds != null) { - reqArgs.put("initialDelaySeconds", AspireClient.serializeValue(initialDelaySeconds)); - } - if (periodSeconds != null) { - reqArgs.put("periodSeconds", AspireClient.serializeValue(periodSeconds)); - } - if (timeoutSeconds != null) { - reqArgs.put("timeoutSeconds", AspireClient.serializeValue(timeoutSeconds)); - } - if (failureThreshold != null) { - reqArgs.put("failureThreshold", AspireClient.serializeValue(failureThreshold)); - } - if (successThreshold != null) { - reqArgs.put("successThreshold", AspireClient.serializeValue(successThreshold)); - } - if (endpointName != null) { - reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); - } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withHttpProbe", reqArgs); +} + +// ===== ILoggerFactory.java ===== +// ILoggerFactory.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILoggerFactory. */ +public class ILoggerFactory extends HandleWrapperBase { + ILoggerFactory(Handle handle, AspireClient client) { + super(handle, client); } - /** Excludes the resource from MCP server exposure */ - public IResource excludeFromMcp() { + /** Creates a logger for a category */ + public ILogger createLogger(String categoryName) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/excludeFromMcp", reqArgs); + reqArgs.put("loggerFactory", AspireClient.serializeValue(getHandle())); + reqArgs.put("categoryName", AspireClient.serializeValue(categoryName)); + return (ILogger) getClient().invokeCapability("Aspire.Hosting/createLogger", reqArgs); } - /** Sets the remote image name for publishing */ - public IComputeResource withRemoteImageName(String remoteImageName) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("remoteImageName", AspireClient.serializeValue(remoteImageName)); - return (IComputeResource) getClient().invokeCapability("Aspire.Hosting/withRemoteImageName", reqArgs); +} + +// ===== IReportingStep.java ===== +// IReportingStep.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingStep. */ +public class IReportingStep extends HandleWrapperBase { + IReportingStep(Handle handle, AspireClient client) { + super(handle, client); } - /** Sets the remote image tag for publishing */ - public IComputeResource withRemoteImageTag(String remoteImageTag) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("remoteImageTag", AspireClient.serializeValue(remoteImageTag)); - return (IComputeResource) getClient().invokeCapability("Aspire.Hosting/withRemoteImageTag", reqArgs); + public IReportingTask createTask(String statusText) { + return createTask(statusText, null); } - /** Adds a pipeline step to the resource */ - public IResource withPipelineStepFactory(String stepName, Function callback, String[] dependsOn, String[] requiredBy, String[] tags, String description) { + /** Creates a reporting task with plain-text status text */ + public IReportingTask createTask(String statusText, CancellationToken cancellationToken) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("stepName", AspireClient.serializeValue(stepName)); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - if (dependsOn != null) { - reqArgs.put("dependsOn", AspireClient.serializeValue(dependsOn)); - } - if (requiredBy != null) { - reqArgs.put("requiredBy", AspireClient.serializeValue(requiredBy)); - } - if (tags != null) { - reqArgs.put("tags", AspireClient.serializeValue(tags)); - } - if (description != null) { - reqArgs.put("description", AspireClient.serializeValue(description)); + reqArgs.put("reportingStep", AspireClient.serializeValue(getHandle())); + reqArgs.put("statusText", AspireClient.serializeValue(statusText)); + if (cancellationToken != null) { + reqArgs.put("cancellationToken", getClient().registerCancellation(cancellationToken)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withPipelineStepFactory", reqArgs); + return (IReportingTask) getClient().invokeCapability("Aspire.Hosting/createTask", reqArgs); } - /** Configures pipeline step dependencies via an async callback */ - public IResource withPipelineConfigurationAsync(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withPipelineConfigurationAsync", reqArgs); + public IReportingTask createMarkdownTask(String markdownString) { + return createMarkdownTask(markdownString, null); } - /** Configures pipeline step dependencies via a callback */ - public IResource withPipelineConfiguration(Function callback) { + /** Creates a reporting task with Markdown-formatted status text */ + public IReportingTask createMarkdownTask(String markdownString, CancellationToken cancellationToken) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + reqArgs.put("reportingStep", AspireClient.serializeValue(getHandle())); + reqArgs.put("markdownString", AspireClient.serializeValue(markdownString)); + if (cancellationToken != null) { + reqArgs.put("cancellationToken", getClient().registerCancellation(cancellationToken)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withPipelineConfiguration", reqArgs); + return (IReportingTask) getClient().invokeCapability("Aspire.Hosting/createMarkdownTask", reqArgs); } - /** Gets the resource name */ - public String getResourceName() { + /** Logs a plain-text message for the reporting step */ + public void logStep(String level, String message) { Map reqArgs = new HashMap<>(); - reqArgs.put("resource", AspireClient.serializeValue(getHandle())); - return (String) getClient().invokeCapability("Aspire.Hosting/getResourceName", reqArgs); + reqArgs.put("reportingStep", AspireClient.serializeValue(getHandle())); + reqArgs.put("level", AspireClient.serializeValue(level)); + reqArgs.put("message", AspireClient.serializeValue(message)); + getClient().invokeCapability("Aspire.Hosting/logStep", reqArgs); } - /** Subscribes to the BeforeResourceStarted event */ - public IResource onBeforeResourceStarted(Function callback) { + /** Logs a Markdown-formatted message for the reporting step */ + public void logStepMarkdown(String level, String markdownString) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onBeforeResourceStarted", reqArgs); + reqArgs.put("reportingStep", AspireClient.serializeValue(getHandle())); + reqArgs.put("level", AspireClient.serializeValue(level)); + reqArgs.put("markdownString", AspireClient.serializeValue(markdownString)); + getClient().invokeCapability("Aspire.Hosting/logStepMarkdown", reqArgs); } - /** Subscribes to the ResourceStopped event */ - public IResource onResourceStopped(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onResourceStopped", reqArgs); + /** Completes the reporting step with plain-text completion text */ + public void completeStep(String completionText, CompleteStepOptions options) { + var completionState = options == null ? null : options.getCompletionState(); + var cancellationToken = options == null ? null : options.getCancellationToken(); + completeStepImpl(completionText, completionState, cancellationToken); } - /** Subscribes to the InitializeResource event */ - public IResource onInitializeResource(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onInitializeResource", reqArgs); + public void completeStep(String completionText) { + completeStep(completionText, null); } - /** Subscribes to the ResourceEndpointsAllocated event */ - public IResourceWithEndpoints onResourceEndpointsAllocated(Function callback) { + /** Completes the reporting step with plain-text completion text */ + private void completeStepImpl(String completionText, String completionState, CancellationToken cancellationToken) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + reqArgs.put("reportingStep", AspireClient.serializeValue(getHandle())); + reqArgs.put("completionText", AspireClient.serializeValue(completionText)); + if (completionState != null) { + reqArgs.put("completionState", AspireClient.serializeValue(completionState)); + } + if (cancellationToken != null) { + reqArgs.put("cancellationToken", getClient().registerCancellation(cancellationToken)); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/onResourceEndpointsAllocated", reqArgs); + getClient().invokeCapability("Aspire.Hosting/completeStep", reqArgs); } - /** Subscribes to the ResourceReady event */ - public IResource onResourceReady(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onResourceReady", reqArgs); + /** Completes the reporting step with Markdown-formatted completion text */ + public void completeStepMarkdown(String markdownString, CompleteStepMarkdownOptions options) { + var completionState = options == null ? null : options.getCompletionState(); + var cancellationToken = options == null ? null : options.getCancellationToken(); + completeStepMarkdownImpl(markdownString, completionState, cancellationToken); } - /** Adds an optional string parameter */ - public IResource withOptionalString(String value, Boolean enabled) { + public void completeStepMarkdown(String markdownString) { + completeStepMarkdown(markdownString, null); + } + + /** Completes the reporting step with Markdown-formatted completion text */ + private void completeStepMarkdownImpl(String markdownString, String completionState, CancellationToken cancellationToken) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (value != null) { - reqArgs.put("value", AspireClient.serializeValue(value)); + reqArgs.put("reportingStep", AspireClient.serializeValue(getHandle())); + reqArgs.put("markdownString", AspireClient.serializeValue(markdownString)); + if (completionState != null) { + reqArgs.put("completionState", AspireClient.serializeValue(completionState)); } - if (enabled != null) { - reqArgs.put("enabled", AspireClient.serializeValue(enabled)); + if (cancellationToken != null) { + reqArgs.put("cancellationToken", getClient().registerCancellation(cancellationToken)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalString", reqArgs); + getClient().invokeCapability("Aspire.Hosting/completeStepMarkdown", reqArgs); } - /** Configures the resource with a DTO */ - public IResource withConfig(TestConfigDto config) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("config", AspireClient.serializeValue(config)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConfig", reqArgs); +} + +// ===== IReportingTask.java ===== +// IReportingTask.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingTask. */ +public class IReportingTask extends HandleWrapperBase { + IReportingTask(Handle handle, AspireClient client) { + super(handle, client); } - /** Configures environment with callback (test version) */ - public IResourceWithEnvironment testWithEnvironmentCallback(Function callback) { + public void updateTask(String statusText) { + updateTask(statusText, null); + } + + /** Updates the reporting task with plain-text status text */ + public void updateTask(String statusText, CancellationToken cancellationToken) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + reqArgs.put("reportingTask", AspireClient.serializeValue(getHandle())); + reqArgs.put("statusText", AspireClient.serializeValue(statusText)); + if (cancellationToken != null) { + reqArgs.put("cancellationToken", getClient().registerCancellation(cancellationToken)); } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWithEnvironmentCallback", reqArgs); + getClient().invokeCapability("Aspire.Hosting/updateTask", reqArgs); } - /** Sets the created timestamp */ - public IResource withCreatedAt(String createdAt) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("createdAt", AspireClient.serializeValue(createdAt)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCreatedAt", reqArgs); + public void updateTaskMarkdown(String markdownString) { + updateTaskMarkdown(markdownString, null); } - /** Sets the modified timestamp */ - public IResource withModifiedAt(String modifiedAt) { + /** Updates the reporting task with Markdown-formatted status text */ + public void updateTaskMarkdown(String markdownString, CancellationToken cancellationToken) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("modifiedAt", AspireClient.serializeValue(modifiedAt)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withModifiedAt", reqArgs); + reqArgs.put("reportingTask", AspireClient.serializeValue(getHandle())); + reqArgs.put("markdownString", AspireClient.serializeValue(markdownString)); + if (cancellationToken != null) { + reqArgs.put("cancellationToken", getClient().registerCancellation(cancellationToken)); + } + getClient().invokeCapability("Aspire.Hosting/updateTaskMarkdown", reqArgs); } - /** Sets the correlation ID */ - public IResource withCorrelationId(String correlationId) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("correlationId", AspireClient.serializeValue(correlationId)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCorrelationId", reqArgs); + /** Completes the reporting task with plain-text completion text */ + public void completeTask(CompleteTaskOptions options) { + var completionMessage = options == null ? null : options.getCompletionMessage(); + var completionState = options == null ? null : options.getCompletionState(); + var cancellationToken = options == null ? null : options.getCancellationToken(); + completeTaskImpl(completionMessage, completionState, cancellationToken); } - /** Configures with optional callback */ - public IResource withOptionalCallback(Function callback) { + public void completeTask() { + completeTask(null); + } + + /** Completes the reporting task with plain-text completion text */ + private void completeTaskImpl(String completionMessage, String completionState, CancellationToken cancellationToken) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + reqArgs.put("reportingTask", AspireClient.serializeValue(getHandle())); + if (completionMessage != null) { + reqArgs.put("completionMessage", AspireClient.serializeValue(completionMessage)); + } + if (completionState != null) { + reqArgs.put("completionState", AspireClient.serializeValue(completionState)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalCallback", reqArgs); + if (cancellationToken != null) { + reqArgs.put("cancellationToken", getClient().registerCancellation(cancellationToken)); + } + getClient().invokeCapability("Aspire.Hosting/completeTask", reqArgs); } - /** Sets the resource status */ - public IResource withStatus(TestResourceStatus status) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("status", AspireClient.serializeValue(status)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withStatus", reqArgs); + /** Completes the reporting task with Markdown-formatted completion text */ + public void completeTaskMarkdown(String markdownString, CompleteTaskMarkdownOptions options) { + var completionState = options == null ? null : options.getCompletionState(); + var cancellationToken = options == null ? null : options.getCancellationToken(); + completeTaskMarkdownImpl(markdownString, completionState, cancellationToken); } - /** Configures with nested DTO */ - public IResource withNestedConfig(TestNestedDto config) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("config", AspireClient.serializeValue(config)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withNestedConfig", reqArgs); + public void completeTaskMarkdown(String markdownString) { + completeTaskMarkdown(markdownString, null); } - /** Adds validation callback */ - public IResource withValidator(Function validator) { + /** Completes the reporting task with Markdown-formatted completion text */ + private void completeTaskMarkdownImpl(String markdownString, String completionState, CancellationToken cancellationToken) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (validator != null) { - reqArgs.put("validator", getClient().registerCallback(validator)); + reqArgs.put("reportingTask", AspireClient.serializeValue(getHandle())); + reqArgs.put("markdownString", AspireClient.serializeValue(markdownString)); + if (completionState != null) { + reqArgs.put("completionState", AspireClient.serializeValue(completionState)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withValidator", reqArgs); + if (cancellationToken != null) { + reqArgs.put("cancellationToken", getClient().registerCancellation(cancellationToken)); + } + getClient().invokeCapability("Aspire.Hosting/completeTaskMarkdown", reqArgs); } - /** Waits for another resource (test version) */ - public IResource testWaitFor(IResource dependency) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWaitFor", reqArgs); +} + +// ===== IResource.java ===== +// IResource.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource. */ +public class IResource extends ResourceBuilderBase { + IResource(Handle handle, AspireClient client) { + super(handle, client); } - /** Adds a dependency on another resource */ - public IResource withDependency(IResourceWithConnectionString dependency) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDependency", reqArgs); +} + +// ===== IResourceWithArgs.java ===== +// IResourceWithArgs.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs. */ +public class IResourceWithArgs extends ResourceBuilderBase { + IResourceWithArgs(Handle handle, AspireClient client) { + super(handle, client); } - /** Sets the endpoints */ - public IResource withEndpoints(String[] endpoints) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("endpoints", AspireClient.serializeValue(endpoints)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEndpoints", reqArgs); +} + +// ===== IResourceWithConnectionString.java ===== +// IResourceWithConnectionString.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString. */ +public class IResourceWithConnectionString extends ResourceBuilderBase { + IResourceWithConnectionString(Handle handle, AspireClient client) { + super(handle, client); + } + +} + +// ===== IResourceWithContainerFiles.java ===== +// IResourceWithContainerFiles.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles. */ +public class IResourceWithContainerFiles extends ResourceBuilderBase { + IResourceWithContainerFiles(Handle handle, AspireClient client) { + super(handle, client); } - /** Sets environment variables */ - public IResourceWithEnvironment withEnvironmentVariables(Map variables) { + /** Sets the source directory for container files */ + public IResourceWithContainerFiles withContainerFilesSource(String sourcePath) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("variables", AspireClient.serializeValue(variables)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEnvironmentVariables", reqArgs); + reqArgs.put("sourcePath", AspireClient.serializeValue(sourcePath)); + getClient().invokeCapability("Aspire.Hosting/withContainerFilesSource", reqArgs); + return this; } - /** Performs a cancellable operation */ - public IResource withCancellableOperation(Function operation) { + /** Clears all container file sources */ + public IResourceWithContainerFiles clearContainerFilesSources() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (operation != null) { - reqArgs.put("operation", getClient().registerCallback(operation)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCancellableOperation", reqArgs); + getClient().invokeCapability("Aspire.Hosting/clearContainerFilesSources", reqArgs); + return this; } } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference. */ -class EndpointReference extends HandleWrapperBase { - EndpointReference(Handle handle, AspireClient client) { - super(handle, client); - } +// ===== IResourceWithEndpoints.java ===== +// IResourceWithEndpoints.java - GENERATED CODE - DO NOT EDIT - /** Gets the Resource property */ - public IResourceWithEndpoints resource() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReference.resource", reqArgs); - } +package aspire; - /** Gets the EndpointName property */ - public String endpointName() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (String) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReference.endpointName", reqArgs); - } +import java.util.*; +import java.util.function.*; - /** Gets the ErrorMessage property */ - public String errorMessage() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (String) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReference.errorMessage", reqArgs); +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints. */ +public class IResourceWithEndpoints extends ResourceBuilderBase { + IResourceWithEndpoints(Handle handle, AspireClient client) { + super(handle, client); } - /** Sets the ErrorMessage property */ - public EndpointReference setErrorMessage(String value) { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (EndpointReference) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReference.setErrorMessage", reqArgs); - } +} - /** Gets the IsAllocated property */ - public boolean isAllocated() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (boolean) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReference.isAllocated", reqArgs); - } +// ===== IResourceWithEnvironment.java ===== +// IResourceWithEnvironment.java - GENERATED CODE - DO NOT EDIT - /** Gets the Exists property */ - public boolean exists() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (boolean) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReference.exists", reqArgs); - } +package aspire; - /** Gets the IsHttp property */ - public boolean isHttp() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (boolean) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReference.isHttp", reqArgs); - } +import java.util.*; +import java.util.function.*; - /** Gets the IsHttps property */ - public boolean isHttps() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (boolean) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReference.isHttps", reqArgs); +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment. */ +public class IResourceWithEnvironment extends ResourceBuilderBase { + IResourceWithEnvironment(Handle handle, AspireClient client) { + super(handle, client); } - /** Gets the TlsEnabled property */ - public boolean tlsEnabled() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (boolean) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReference.tlsEnabled", reqArgs); - } +} - /** Gets the Port property */ - public double port() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (double) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReference.port", reqArgs); - } +// ===== IResourceWithParent.java ===== +// IResourceWithParent.java - GENERATED CODE - DO NOT EDIT - /** Gets the TargetPort property */ - public double targetPort() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (double) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReference.targetPort", reqArgs); - } +package aspire; - /** Gets the Host property */ - public String host() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (String) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReference.host", reqArgs); - } +import java.util.*; +import java.util.function.*; - /** Gets the Scheme property */ - public String scheme() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (String) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReference.scheme", reqArgs); +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithParent. */ +public class IResourceWithParent extends ResourceBuilderBase { + IResourceWithParent(Handle handle, AspireClient client) { + super(handle, client); } - /** Gets the Url property */ - public String url() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (String) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReference.url", reqArgs); - } +} - /** Gets the URL of the endpoint asynchronously */ - public String getValueAsync(CancellationToken cancellationToken) { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - if (cancellationToken != null) { - reqArgs.put("cancellationToken", getClient().registerCancellation(cancellationToken)); - } - return (String) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/getValueAsync", reqArgs); - } +// ===== IResourceWithWaitSupport.java ===== +// IResourceWithWaitSupport.java - GENERATED CODE - DO NOT EDIT - /** Gets a conditional expression that resolves to the enabledValue when TLS is enabled on the endpoint, or to the disabledValue otherwise. */ - public ReferenceExpression getTlsValue(ReferenceExpression enabledValue, ReferenceExpression disabledValue) { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - reqArgs.put("enabledValue", AspireClient.serializeValue(enabledValue)); - reqArgs.put("disabledValue", AspireClient.serializeValue(disabledValue)); - return (ReferenceExpression) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReference.getTlsValue", reqArgs); - } +package aspire; -} +import java.util.*; +import java.util.function.*; -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression. */ -class EndpointReferenceExpression extends HandleWrapperBase { - EndpointReferenceExpression(Handle handle, AspireClient client) { +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport. */ +public class IResourceWithWaitSupport extends ResourceBuilderBase { + IResourceWithWaitSupport(Handle handle, AspireClient client) { super(handle, client); } - /** Gets the Endpoint property */ - public EndpointReference endpoint() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (EndpointReference) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.endpoint", reqArgs); - } +} - /** Gets the Property property */ - public EndpointProperty property() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (EndpointProperty) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.property", reqArgs); - } +// ===== IServiceProvider.java ===== +// IServiceProvider.java - GENERATED CODE - DO NOT EDIT - /** Gets the ValueExpression property */ - public String valueExpression() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (String) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EndpointReferenceExpression.valueExpression", reqArgs); - } +package aspire; -} +import java.util.*; +import java.util.function.*; -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext. */ -class EnvironmentCallbackContext extends HandleWrapperBase { - EnvironmentCallbackContext(Handle handle, AspireClient client) { +/** Wrapper for System.ComponentModel/System.IServiceProvider. */ +public class IServiceProvider extends HandleWrapperBase { + IServiceProvider(Handle handle, AspireClient client) { super(handle, client); } - /** Gets the EnvironmentVariables property */ - private AspireDict environmentVariablesField; - public AspireDict environmentVariables() { - if (environmentVariablesField == null) { - environmentVariablesField = new AspireDict<>(getHandle(), getClient(), "Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.environmentVariables"); - } - return environmentVariablesField; + /** Gets the distributed application eventing service from the service provider */ + public IDistributedApplicationEventing getEventing() { + Map reqArgs = new HashMap<>(); + reqArgs.put("serviceProvider", AspireClient.serializeValue(getHandle())); + return (IDistributedApplicationEventing) getClient().invokeCapability("Aspire.Hosting/getEventing", reqArgs); } - /** Gets the CancellationToken property */ - public CancellationToken cancellationToken() { + /** Gets the logger factory from the service provider */ + public ILoggerFactory getLoggerFactory() { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (CancellationToken) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.cancellationToken", reqArgs); + reqArgs.put("serviceProvider", AspireClient.serializeValue(getHandle())); + return (ILoggerFactory) getClient().invokeCapability("Aspire.Hosting/getLoggerFactory", reqArgs); } - /** Gets the Logger property */ - public ILogger logger() { + /** Gets the resource logger service from the service provider */ + public ResourceLoggerService getResourceLoggerService() { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (ILogger) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.logger", reqArgs); + reqArgs.put("serviceProvider", AspireClient.serializeValue(getHandle())); + return (ResourceLoggerService) getClient().invokeCapability("Aspire.Hosting/getResourceLoggerService", reqArgs); } - /** Sets the Logger property */ - public EnvironmentCallbackContext setLogger(ILogger value) { + /** Gets the distributed application model from the service provider */ + public DistributedApplicationModel getDistributedApplicationModel() { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (EnvironmentCallbackContext) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.setLogger", reqArgs); + reqArgs.put("serviceProvider", AspireClient.serializeValue(getHandle())); + return (DistributedApplicationModel) getClient().invokeCapability("Aspire.Hosting/getDistributedApplicationModel", reqArgs); } - /** Gets the Resource property */ - public IResource resource() { + /** Gets the resource notification service from the service provider */ + public ResourceNotificationService getResourceNotificationService() { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.resource", reqArgs); + reqArgs.put("serviceProvider", AspireClient.serializeValue(getHandle())); + return (ResourceNotificationService) getClient().invokeCapability("Aspire.Hosting/getResourceNotificationService", reqArgs); } - /** Gets the ExecutionContext property */ - public DistributedApplicationExecutionContext executionContext() { + /** Gets the user secrets manager from the service provider */ + public IUserSecretsManager getUserSecretsManager() { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (DistributedApplicationExecutionContext) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/EnvironmentCallbackContext.executionContext", reqArgs); + reqArgs.put("serviceProvider", AspireClient.serializeValue(getHandle())); + return (IUserSecretsManager) getClient().invokeCapability("Aspire.Hosting/getUserSecretsManager", reqArgs); } } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource. */ -class ExecutableResource extends ResourceBuilderBase { - ExecutableResource(Handle handle, AspireClient client) { - super(handle, client); - } - - /** Configures a resource to use a container registry */ - public IResource withContainerRegistry(IResource registry) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("registry", AspireClient.serializeValue(registry)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withContainerRegistry", reqArgs); - } +// ===== ITestVaultResource.java ===== +// ITestVaultResource.java - GENERATED CODE - DO NOT EDIT - /** Sets the base image for a Dockerfile build */ - public IResource withDockerfileBaseImage(String buildImage, String runtimeImage) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (buildImage != null) { - reqArgs.put("buildImage", AspireClient.serializeValue(buildImage)); - } - if (runtimeImage != null) { - reqArgs.put("runtimeImage", AspireClient.serializeValue(runtimeImage)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withDockerfileBaseImage", reqArgs); - } +package aspire; - /** Publishes the executable as a Docker container */ - public ExecutableResource publishAsDockerFile() { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (ExecutableResource) getClient().invokeCapability("Aspire.Hosting/publishAsDockerFile", reqArgs); - } +import java.util.*; +import java.util.function.*; - /** Publishes an executable as a Docker file with optional container configuration */ - public ExecutableResource publishAsDockerFileWithConfigure(Function configure) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (configure != null) { - reqArgs.put("configure", getClient().registerCallback(configure)); - } - return (ExecutableResource) getClient().invokeCapability("Aspire.Hosting/publishAsDockerFileWithConfigure", reqArgs); +/** Wrapper for Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.ITestVaultResource. */ +public class ITestVaultResource extends ResourceBuilderBase { + ITestVaultResource(Handle handle, AspireClient client) { + super(handle, client); } - /** Sets the executable command */ - public ExecutableResource withExecutableCommand(String command) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("command", AspireClient.serializeValue(command)); - return (ExecutableResource) getClient().invokeCapability("Aspire.Hosting/withExecutableCommand", reqArgs); +} + +// ===== IUserSecretsManager.java ===== +// IUserSecretsManager.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.IUserSecretsManager. */ +public class IUserSecretsManager extends HandleWrapperBase { + IUserSecretsManager(Handle handle, AspireClient client) { + super(handle, client); } - /** Sets the executable working directory */ - public ExecutableResource withWorkingDirectory(String workingDirectory) { + /** Gets the IsAvailable property */ + public boolean isAvailable() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("workingDirectory", AspireClient.serializeValue(workingDirectory)); - return (ExecutableResource) getClient().invokeCapability("Aspire.Hosting/withWorkingDirectory", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (boolean) getClient().invokeCapability("Aspire.Hosting/IUserSecretsManager.isAvailable", reqArgs); } - /** Configures an MCP server endpoint on the resource */ - public IResourceWithEndpoints withMcpServer(String path, String endpointName) { + /** Gets the FilePath property */ + public String filePath() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (path != null) { - reqArgs.put("path", AspireClient.serializeValue(path)); - } - if (endpointName != null) { - reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); - } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withMcpServer", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (String) getClient().invokeCapability("Aspire.Hosting/IUserSecretsManager.filePath", reqArgs); } - /** Configures OTLP telemetry export */ - public IResourceWithEnvironment withOtlpExporter() { + /** Attempts to set a user secret value */ + public boolean trySetSecret(String name, String value) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withOtlpExporter", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("value", AspireClient.serializeValue(value)); + return (boolean) getClient().invokeCapability("Aspire.Hosting/IUserSecretsManager.trySetSecret", reqArgs); } - /** Configures OTLP telemetry export with specific protocol */ - public IResourceWithEnvironment withOtlpExporterProtocol(OtlpProtocol protocol) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("protocol", AspireClient.serializeValue(protocol)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withOtlpExporterProtocol", reqArgs); + public void saveStateJson(String json) { + saveStateJson(json, null); } - /** Adds a required command dependency */ - public IResource withRequiredCommand(String command, String helpLink) { + /** Saves state to user secrets from a JSON string */ + public void saveStateJson(String json, CancellationToken cancellationToken) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("command", AspireClient.serializeValue(command)); - if (helpLink != null) { - reqArgs.put("helpLink", AspireClient.serializeValue(helpLink)); + reqArgs.put("userSecretsManager", AspireClient.serializeValue(getHandle())); + reqArgs.put("json", AspireClient.serializeValue(json)); + if (cancellationToken != null) { + reqArgs.put("cancellationToken", getClient().registerCancellation(cancellationToken)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withRequiredCommand", reqArgs); + getClient().invokeCapability("Aspire.Hosting/saveStateJson", reqArgs); } - /** Sets an environment variable */ - public IResourceWithEnvironment withEnvironment(String name, String value) { + /** Gets a secret value if it exists, or sets it to the provided value if it does not */ + public void getOrSetSecret(IResource resourceBuilder, String name, String value) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("userSecretsManager", AspireClient.serializeValue(getHandle())); + reqArgs.put("resourceBuilder", AspireClient.serializeValue(resourceBuilder)); reqArgs.put("name", AspireClient.serializeValue(name)); reqArgs.put("value", AspireClient.serializeValue(value)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironment", reqArgs); + getClient().invokeCapability("Aspire.Hosting/getOrSetSecret", reqArgs); } - /** Adds an environment variable with a reference expression */ - public IResourceWithEnvironment withEnvironmentExpression(String name, ReferenceExpression value) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentExpression", reqArgs); + public void getOrSetSecret(ResourceBuilderBase resourceBuilder, String name, String value) { + getOrSetSecret(new IResource(resourceBuilder.getHandle(), resourceBuilder.getClient()), name, value); } - /** Sets environment variables via callback */ - public IResourceWithEnvironment withEnvironmentCallback(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentCallback", reqArgs); +} + +// ===== IconVariant.java ===== +// IconVariant.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** IconVariant enum. */ +public enum IconVariant implements WireValueEnum { + REGULAR("Regular"), + FILLED("Filled"); + + private final String value; + + IconVariant(String value) { + this.value = value; } - /** Sets environment variables via async callback */ - public IResourceWithEnvironment withEnvironmentCallbackAsync(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + public String getValue() { return value; } + + public static IconVariant fromValue(String value) { + for (IconVariant e : values()) { + if (e.value.equals(value)) return e; } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentCallbackAsync", reqArgs); + throw new IllegalArgumentException("Unknown value: " + value); } +} - /** Sets an environment variable from an endpoint reference */ - public IResourceWithEnvironment withEnvironmentEndpoint(String name, EndpointReference endpointReference) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("endpointReference", AspireClient.serializeValue(endpointReference)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentEndpoint", reqArgs); - } +// ===== ImagePullPolicy.java ===== +// ImagePullPolicy.java - GENERATED CODE - DO NOT EDIT - /** Sets an environment variable from a parameter resource */ - public IResourceWithEnvironment withEnvironmentParameter(String name, ParameterResource parameter) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("parameter", AspireClient.serializeValue(parameter)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentParameter", reqArgs); +package aspire; + +import java.util.*; +import java.util.function.*; + +/** ImagePullPolicy enum. */ +public enum ImagePullPolicy implements WireValueEnum { + DEFAULT("Default"), + ALWAYS("Always"), + MISSING("Missing"), + NEVER("Never"); + + private final String value; + + ImagePullPolicy(String value) { + this.value = value; } - /** Sets an environment variable from a connection string resource */ - public IResourceWithEnvironment withEnvironmentConnectionString(String envVarName, IResourceWithConnectionString resource) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("envVarName", AspireClient.serializeValue(envVarName)); - reqArgs.put("resource", AspireClient.serializeValue(resource)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentConnectionString", reqArgs); + public String getValue() { return value; } + + public static ImagePullPolicy fromValue(String value) { + for (ImagePullPolicy e : values()) { + if (e.value.equals(value)) return e; + } + throw new IllegalArgumentException("Unknown value: " + value); } +} - /** Adds arguments */ - public IResourceWithArgs withArgs(String[] args) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("args", AspireClient.serializeValue(args)); - return (IResourceWithArgs) getClient().invokeCapability("Aspire.Hosting/withArgs", reqArgs); +// ===== InitializeResourceEvent.java ===== +// InitializeResourceEvent.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent. */ +public class InitializeResourceEvent extends HandleWrapperBase { + InitializeResourceEvent(Handle handle, AspireClient client) { + super(handle, client); } - /** Sets command-line arguments via callback */ - public IResourceWithArgs withArgsCallback(Function callback) { + /** Gets the Resource property */ + public IResource resource() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResourceWithArgs) getClient().invokeCapability("Aspire.Hosting/withArgsCallback", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (IResource) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/InitializeResourceEvent.resource", reqArgs); } - /** Sets command-line arguments via async callback */ - public IResourceWithArgs withArgsCallbackAsync(Function callback) { + /** Gets the Eventing property */ + public IDistributedApplicationEventing eventing() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResourceWithArgs) getClient().invokeCapability("Aspire.Hosting/withArgsCallbackAsync", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (IDistributedApplicationEventing) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/InitializeResourceEvent.eventing", reqArgs); } - /** Adds a reference to another resource */ - public IResourceWithEnvironment withReference(IResource source, String connectionName, Boolean optional, String name) { + /** Gets the Logger property */ + public ILogger logger() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("source", AspireClient.serializeValue(source)); - if (connectionName != null) { - reqArgs.put("connectionName", AspireClient.serializeValue(connectionName)); - } - if (optional != null) { - reqArgs.put("optional", AspireClient.serializeValue(optional)); - } - if (name != null) { - reqArgs.put("name", AspireClient.serializeValue(name)); - } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withReference", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (ILogger) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/InitializeResourceEvent.logger", reqArgs); } - /** Adds a reference to a URI */ - public IResourceWithEnvironment withReferenceUri(String name, String uri) { + /** Gets the Notifications property */ + public ResourceNotificationService notifications() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("uri", AspireClient.serializeValue(uri)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withReferenceUri", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (ResourceNotificationService) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/InitializeResourceEvent.notifications", reqArgs); } - /** Adds a reference to an external service */ - public IResourceWithEnvironment withReferenceExternalService(ExternalServiceResource externalService) { + /** Gets the Services property */ + public IServiceProvider services() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("externalService", AspireClient.serializeValue(externalService)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withReferenceExternalService", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (IServiceProvider) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/InitializeResourceEvent.services", reqArgs); } - /** Adds a reference to an endpoint */ - public IResourceWithEnvironment withReferenceEndpoint(EndpointReference endpointReference) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("endpointReference", AspireClient.serializeValue(endpointReference)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withReferenceEndpoint", reqArgs); +} + +// ===== OtlpProtocol.java ===== +// OtlpProtocol.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** OtlpProtocol enum. */ +public enum OtlpProtocol implements WireValueEnum { + GRPC("Grpc"), + HTTP_PROTOBUF("HttpProtobuf"), + HTTP_JSON("HttpJson"); + + private final String value; + + OtlpProtocol(String value) { + this.value = value; } - /** Adds a network endpoint */ - public IResourceWithEndpoints withEndpoint(Double port, Double targetPort, String scheme, String name, String env, Boolean isProxied, Boolean isExternal, ProtocolType protocol) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (port != null) { - reqArgs.put("port", AspireClient.serializeValue(port)); - } - if (targetPort != null) { - reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); - } - if (scheme != null) { - reqArgs.put("scheme", AspireClient.serializeValue(scheme)); - } - if (name != null) { - reqArgs.put("name", AspireClient.serializeValue(name)); - } - if (env != null) { - reqArgs.put("env", AspireClient.serializeValue(env)); - } - if (isProxied != null) { - reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); - } - if (isExternal != null) { - reqArgs.put("isExternal", AspireClient.serializeValue(isExternal)); - } - if (protocol != null) { - reqArgs.put("protocol", AspireClient.serializeValue(protocol)); + public String getValue() { return value; } + + public static OtlpProtocol fromValue(String value) { + for (OtlpProtocol e : values()) { + if (e.value.equals(value)) return e; } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withEndpoint", reqArgs); + throw new IllegalArgumentException("Unknown value: " + value); + } +} + +// ===== ParameterResource.java ===== +// ParameterResource.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource. */ +public class ParameterResource extends ResourceBuilderBase { + ParameterResource(Handle handle, AspireClient client) { + super(handle, client); } - /** Adds an HTTP endpoint */ - public IResourceWithEndpoints withHttpEndpoint(Double port, Double targetPort, String name, String env, Boolean isProxied) { + /** Configures a resource to use a container registry */ + public ParameterResource withContainerRegistry(IResource registry) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (port != null) { - reqArgs.put("port", AspireClient.serializeValue(port)); - } - if (targetPort != null) { - reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); - } - if (name != null) { - reqArgs.put("name", AspireClient.serializeValue(name)); - } - if (env != null) { - reqArgs.put("env", AspireClient.serializeValue(env)); - } - if (isProxied != null) { - reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); - } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withHttpEndpoint", reqArgs); + reqArgs.put("registry", AspireClient.serializeValue(registry)); + getClient().invokeCapability("Aspire.Hosting/withContainerRegistry", reqArgs); + return this; } - /** Adds an HTTPS endpoint */ - public IResourceWithEndpoints withHttpsEndpoint(Double port, Double targetPort, String name, String env, Boolean isProxied) { + public ParameterResource withContainerRegistry(ResourceBuilderBase registry) { + return withContainerRegistry(new IResource(registry.getHandle(), registry.getClient())); + } + + /** Sets the base image for a Dockerfile build */ + public ParameterResource withDockerfileBaseImage(WithDockerfileBaseImageOptions options) { + var buildImage = options == null ? null : options.getBuildImage(); + var runtimeImage = options == null ? null : options.getRuntimeImage(); + return withDockerfileBaseImageImpl(buildImage, runtimeImage); + } + + public ParameterResource withDockerfileBaseImage() { + return withDockerfileBaseImage(null); + } + + /** Sets the base image for a Dockerfile build */ + private ParameterResource withDockerfileBaseImageImpl(String buildImage, String runtimeImage) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (port != null) { - reqArgs.put("port", AspireClient.serializeValue(port)); - } - if (targetPort != null) { - reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); - } - if (name != null) { - reqArgs.put("name", AspireClient.serializeValue(name)); - } - if (env != null) { - reqArgs.put("env", AspireClient.serializeValue(env)); + if (buildImage != null) { + reqArgs.put("buildImage", AspireClient.serializeValue(buildImage)); } - if (isProxied != null) { - reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); + if (runtimeImage != null) { + reqArgs.put("runtimeImage", AspireClient.serializeValue(runtimeImage)); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withHttpsEndpoint", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withDockerfileBaseImage", reqArgs); + return this; } - /** Makes HTTP endpoints externally accessible */ - public IResourceWithEndpoints withExternalHttpEndpoints() { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withExternalHttpEndpoints", reqArgs); + public ParameterResource withDescription(String description) { + return withDescription(description, null); } - /** Gets an endpoint reference */ - public EndpointReference getEndpoint(String name) { + /** Sets a parameter description */ + public ParameterResource withDescription(String description, Boolean enableMarkdown) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - return (EndpointReference) getClient().invokeCapability("Aspire.Hosting/getEndpoint", reqArgs); + reqArgs.put("description", AspireClient.serializeValue(description)); + if (enableMarkdown != null) { + reqArgs.put("enableMarkdown", AspireClient.serializeValue(enableMarkdown)); + } + getClient().invokeCapability("Aspire.Hosting/withDescription", reqArgs); + return this; } - /** Configures resource for HTTP/2 */ - public IResourceWithEndpoints asHttp2Service() { + public ParameterResource withRequiredCommand(String command) { + return withRequiredCommand(command, null); + } + + /** Adds a required command dependency */ + public ParameterResource withRequiredCommand(String command, String helpLink) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/asHttp2Service", reqArgs); + reqArgs.put("command", AspireClient.serializeValue(command)); + if (helpLink != null) { + reqArgs.put("helpLink", AspireClient.serializeValue(helpLink)); + } + getClient().invokeCapability("Aspire.Hosting/withRequiredCommand", reqArgs); + return this; } /** Customizes displayed URLs via callback */ - public IResource withUrlsCallback(Function callback) { + public ParameterResource withUrlsCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var obj = (ResourceUrlsCallbackContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlsCallback", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrlsCallback", reqArgs); + return this; } /** Customizes displayed URLs via async callback */ - public IResource withUrlsCallbackAsync(Function callback) { + public ParameterResource withUrlsCallbackAsync(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceUrlsCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlsCallbackAsync", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrlsCallbackAsync", reqArgs); + return this; + } + + public ParameterResource withUrl(String url) { + return withUrl(url, null); } /** Adds or modifies displayed URLs */ - public IResource withUrl(String url, String displayText) { + public ParameterResource withUrl(String url, String displayText) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("url", AspireClient.serializeValue(url)); if (displayText != null) { reqArgs.put("displayText", AspireClient.serializeValue(displayText)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrl", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrl", reqArgs); + return this; + } + + public ParameterResource withUrlExpression(ReferenceExpression url) { + return withUrlExpression(url, null); } /** Adds a URL using a reference expression */ - public IResource withUrlExpression(ReferenceExpression url, String displayText) { + public ParameterResource withUrlExpression(ReferenceExpression url, String displayText) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("url", AspireClient.serializeValue(url)); if (displayText != null) { reqArgs.put("displayText", AspireClient.serializeValue(displayText)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlExpression", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrlExpression", reqArgs); + return this; } /** Customizes the URL for a specific endpoint via callback */ - public IResource withUrlForEndpoint(String endpointName, Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlForEndpoint", reqArgs); - } - - /** Adds a URL for a specific endpoint via factory callback */ - public IResourceWithEndpoints withUrlForEndpointFactory(String endpointName, Function callback) { + public ParameterResource withUrlForEndpoint(String endpointName, AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var obj = (ResourceUrlAnnotation) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withUrlForEndpointFactory", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrlForEndpoint", reqArgs); + return this; } /** Excludes the resource from the deployment manifest */ - public IResource excludeFromManifest() { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/excludeFromManifest", reqArgs); - } - - /** Waits for another resource to be ready */ - public IResourceWithWaitSupport waitFor(IResource dependency) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitFor", reqArgs); - } - - /** Waits for another resource with specific behavior */ - public IResourceWithWaitSupport waitForWithBehavior(IResource dependency, WaitBehavior waitBehavior) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - reqArgs.put("waitBehavior", AspireClient.serializeValue(waitBehavior)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForWithBehavior", reqArgs); - } - - /** Waits for another resource to start */ - public IResourceWithWaitSupport waitForStart(IResource dependency) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForStart", reqArgs); - } - - /** Waits for another resource to start with specific behavior */ - public IResourceWithWaitSupport waitForStartWithBehavior(IResource dependency, WaitBehavior waitBehavior) { + public ParameterResource excludeFromManifest() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - reqArgs.put("waitBehavior", AspireClient.serializeValue(waitBehavior)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForStartWithBehavior", reqArgs); + getClient().invokeCapability("Aspire.Hosting/excludeFromManifest", reqArgs); + return this; } /** Prevents resource from starting automatically */ - public IResource withExplicitStart() { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withExplicitStart", reqArgs); - } - - /** Waits for resource completion */ - public IResourceWithWaitSupport waitForCompletion(IResource dependency, Double exitCode) { + public ParameterResource withExplicitStart() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - if (exitCode != null) { - reqArgs.put("exitCode", AspireClient.serializeValue(exitCode)); - } - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForCompletion", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withExplicitStart", reqArgs); + return this; } /** Adds a health check by key */ - public IResource withHealthCheck(String key) { + public ParameterResource withHealthCheck(String key) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("key", AspireClient.serializeValue(key)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withHealthCheck", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withHealthCheck", reqArgs); + return this; } - /** Adds an HTTP health check */ - public IResourceWithEndpoints withHttpHealthCheck(String path, Double statusCode, String endpointName) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (path != null) { - reqArgs.put("path", AspireClient.serializeValue(path)); - } - if (statusCode != null) { - reqArgs.put("statusCode", AspireClient.serializeValue(statusCode)); - } - if (endpointName != null) { - reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); - } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withHttpHealthCheck", reqArgs); + public ParameterResource withCommand(String name, String displayName, AspireFunc1 executeCommand) { + return withCommand(name, displayName, executeCommand, null); } /** Adds a resource command */ - public IResource withCommand(String name, String displayName, Function executeCommand, CommandOptions commandOptions) { + public ParameterResource withCommand(String name, String displayName, AspireFunc1 executeCommand, CommandOptions commandOptions) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("name", AspireClient.serializeValue(name)); reqArgs.put("displayName", AspireClient.serializeValue(displayName)); - if (executeCommand != null) { - reqArgs.put("executeCommand", getClient().registerCallback(executeCommand)); + var executeCommandId = getClient().registerCallback(args -> { + var arg = (ExecuteCommandContext) args[0]; + return AspireClient.awaitValue(executeCommand.invoke(arg)); + }); + if (executeCommandId != null) { + reqArgs.put("executeCommand", executeCommandId); } if (commandOptions != null) { reqArgs.put("commandOptions", AspireClient.serializeValue(commandOptions)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withCommand", reqArgs); - } - - /** Configures developer certificate trust */ - public IResourceWithEnvironment withDeveloperCertificateTrust(boolean trust) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("trust", AspireClient.serializeValue(trust)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withDeveloperCertificateTrust", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withCommand", reqArgs); + return this; } - /** Sets the certificate trust scope */ - public IResourceWithEnvironment withCertificateTrustScope(CertificateTrustScope scope) { + /** Sets the parent relationship */ + public ParameterResource withParentRelationship(IResource parent) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("scope", AspireClient.serializeValue(scope)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withCertificateTrustScope", reqArgs); + reqArgs.put("parent", AspireClient.serializeValue(parent)); + getClient().invokeCapability("Aspire.Hosting/withParentRelationship", reqArgs); + return this; } - /** Configures HTTPS with a developer certificate */ - public IResourceWithEnvironment withHttpsDeveloperCertificate(ParameterResource password) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (password != null) { - reqArgs.put("password", AspireClient.serializeValue(password)); - } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withHttpsDeveloperCertificate", reqArgs); + public ParameterResource withParentRelationship(ResourceBuilderBase parent) { + return withParentRelationship(new IResource(parent.getHandle(), parent.getClient())); } - /** Removes HTTPS certificate configuration */ - public IResourceWithEnvironment withoutHttpsCertificate() { + /** Sets a child relationship */ + public ParameterResource withChildRelationship(IResource child) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withoutHttpsCertificate", reqArgs); + reqArgs.put("child", AspireClient.serializeValue(child)); + getClient().invokeCapability("Aspire.Hosting/withChildRelationship", reqArgs); + return this; } - /** Sets the parent relationship */ - public IResource withParentRelationship(IResource parent) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("parent", AspireClient.serializeValue(parent)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withParentRelationship", reqArgs); + public ParameterResource withChildRelationship(ResourceBuilderBase child) { + return withChildRelationship(new IResource(child.getHandle(), child.getClient())); } - /** Sets a child relationship */ - public IResource withChildRelationship(IResource child) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("child", AspireClient.serializeValue(child)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withChildRelationship", reqArgs); + public ParameterResource withIconName(String iconName) { + return withIconName(iconName, null); } /** Sets the icon for the resource */ - public IResource withIconName(String iconName, IconVariant iconVariant) { + public ParameterResource withIconName(String iconName, IconVariant iconVariant) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("iconName", AspireClient.serializeValue(iconName)); if (iconVariant != null) { reqArgs.put("iconVariant", AspireClient.serializeValue(iconVariant)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withIconName", reqArgs); - } - - /** Adds an HTTP health probe to the resource */ - public IResourceWithEndpoints withHttpProbe(ProbeType probeType, String path, Double initialDelaySeconds, Double periodSeconds, Double timeoutSeconds, Double failureThreshold, Double successThreshold, String endpointName) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("probeType", AspireClient.serializeValue(probeType)); - if (path != null) { - reqArgs.put("path", AspireClient.serializeValue(path)); - } - if (initialDelaySeconds != null) { - reqArgs.put("initialDelaySeconds", AspireClient.serializeValue(initialDelaySeconds)); - } - if (periodSeconds != null) { - reqArgs.put("periodSeconds", AspireClient.serializeValue(periodSeconds)); - } - if (timeoutSeconds != null) { - reqArgs.put("timeoutSeconds", AspireClient.serializeValue(timeoutSeconds)); - } - if (failureThreshold != null) { - reqArgs.put("failureThreshold", AspireClient.serializeValue(failureThreshold)); - } - if (successThreshold != null) { - reqArgs.put("successThreshold", AspireClient.serializeValue(successThreshold)); - } - if (endpointName != null) { - reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); - } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withHttpProbe", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withIconName", reqArgs); + return this; } /** Excludes the resource from MCP server exposure */ - public IResource excludeFromMcp() { + public ParameterResource excludeFromMcp() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/excludeFromMcp", reqArgs); + getClient().invokeCapability("Aspire.Hosting/excludeFromMcp", reqArgs); + return this; } - /** Sets the remote image name for publishing */ - public IComputeResource withRemoteImageName(String remoteImageName) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("remoteImageName", AspireClient.serializeValue(remoteImageName)); - return (IComputeResource) getClient().invokeCapability("Aspire.Hosting/withRemoteImageName", reqArgs); + /** Adds a pipeline step to the resource */ + public ParameterResource withPipelineStepFactory(String stepName, AspireAction1 callback, WithPipelineStepFactoryOptions options) { + var dependsOn = options == null ? null : options.getDependsOn(); + var requiredBy = options == null ? null : options.getRequiredBy(); + var tags = options == null ? null : options.getTags(); + var description = options == null ? null : options.getDescription(); + return withPipelineStepFactoryImpl(stepName, callback, dependsOn, requiredBy, tags, description); } - /** Sets the remote image tag for publishing */ - public IComputeResource withRemoteImageTag(String remoteImageTag) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("remoteImageTag", AspireClient.serializeValue(remoteImageTag)); - return (IComputeResource) getClient().invokeCapability("Aspire.Hosting/withRemoteImageTag", reqArgs); + public ParameterResource withPipelineStepFactory(String stepName, AspireAction1 callback) { + return withPipelineStepFactory(stepName, callback, null); } /** Adds a pipeline step to the resource */ - public IResource withPipelineStepFactory(String stepName, Function callback, String[] dependsOn, String[] requiredBy, String[] tags, String description) { + private ParameterResource withPipelineStepFactoryImpl(String stepName, AspireAction1 callback, String[] dependsOn, String[] requiredBy, String[] tags, String description) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("stepName", AspireClient.serializeValue(stepName)); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var arg = (PipelineStepContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } if (dependsOn != null) { reqArgs.put("dependsOn", AspireClient.serializeValue(dependsOn)); @@ -5182,27 +11003,40 @@ public IResource withPipelineStepFactory(String stepName, Function callback) { + public ParameterResource withPipelineConfigurationAsync(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var arg = (PipelineConfigurationContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withPipelineConfigurationAsync", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withPipelineConfigurationAsync", reqArgs); + return this; } /** Configures pipeline step dependencies via a callback */ - public IResource withPipelineConfiguration(Function callback) { + public ParameterResource withPipelineConfiguration(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var obj = (PipelineConfigurationContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withPipelineConfiguration", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withPipelineConfiguration", reqArgs); + return this; } /** Gets the resource name */ @@ -5213,57 +11047,82 @@ public String getResourceName() { } /** Subscribes to the BeforeResourceStarted event */ - public IResource onBeforeResourceStarted(Function callback) { + public ParameterResource onBeforeResourceStarted(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var arg = (BeforeResourceStartedEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onBeforeResourceStarted", reqArgs); + getClient().invokeCapability("Aspire.Hosting/onBeforeResourceStarted", reqArgs); + return this; } /** Subscribes to the ResourceStopped event */ - public IResource onResourceStopped(Function callback) { + public ParameterResource onResourceStopped(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceStoppedEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onResourceStopped", reqArgs); + getClient().invokeCapability("Aspire.Hosting/onResourceStopped", reqArgs); + return this; } /** Subscribes to the InitializeResource event */ - public IResource onInitializeResource(Function callback) { + public ParameterResource onInitializeResource(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var arg = (InitializeResourceEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onInitializeResource", reqArgs); + getClient().invokeCapability("Aspire.Hosting/onInitializeResource", reqArgs); + return this; } - /** Subscribes to the ResourceEndpointsAllocated event */ - public IResourceWithEndpoints onResourceEndpointsAllocated(Function callback) { + /** Subscribes to the ResourceReady event */ + public ParameterResource onResourceReady(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceReadyEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/onResourceEndpointsAllocated", reqArgs); + getClient().invokeCapability("Aspire.Hosting/onResourceReady", reqArgs); + return this; } - /** Subscribes to the ResourceReady event */ - public IResource onResourceReady(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onResourceReady", reqArgs); + /** Adds an optional string parameter */ + public ParameterResource withOptionalString(WithOptionalStringOptions options) { + var value = options == null ? null : options.getValue(); + var enabled = options == null ? null : options.getEnabled(); + return withOptionalStringImpl(value, enabled); + } + + public ParameterResource withOptionalString() { + return withOptionalString(null); } /** Adds an optional string parameter */ - public IResource withOptionalString(String value, Boolean enabled) { + private ParameterResource withOptionalStringImpl(String value, Boolean enabled) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); if (value != null) { @@ -5272,3367 +11131,4203 @@ public IResource withOptionalString(String value, Boolean enabled) { if (enabled != null) { reqArgs.put("enabled", AspireClient.serializeValue(enabled)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalString", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalString", reqArgs); + return this; } /** Configures the resource with a DTO */ - public IResource withConfig(TestConfigDto config) { + public ParameterResource withConfig(TestConfigDto config) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("config", AspireClient.serializeValue(config)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConfig", reqArgs); - } - - /** Configures environment with callback (test version) */ - public IResourceWithEnvironment testWithEnvironmentCallback(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWithEnvironmentCallback", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConfig", reqArgs); + return this; } /** Sets the created timestamp */ - public IResource withCreatedAt(String createdAt) { + public ParameterResource withCreatedAt(String createdAt) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("createdAt", AspireClient.serializeValue(createdAt)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCreatedAt", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCreatedAt", reqArgs); + return this; } /** Sets the modified timestamp */ - public IResource withModifiedAt(String modifiedAt) { + public ParameterResource withModifiedAt(String modifiedAt) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("modifiedAt", AspireClient.serializeValue(modifiedAt)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withModifiedAt", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withModifiedAt", reqArgs); + return this; } /** Sets the correlation ID */ - public IResource withCorrelationId(String correlationId) { + public ParameterResource withCorrelationId(String correlationId) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("correlationId", AspireClient.serializeValue(correlationId)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCorrelationId", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCorrelationId", reqArgs); + return this; + } + + public ParameterResource withOptionalCallback() { + return withOptionalCallback(null); } /** Configures with optional callback */ - public IResource withOptionalCallback(Function callback) { + public ParameterResource withOptionalCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = callback == null ? null : getClient().registerCallback(args -> { + var arg = (TestCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalCallback", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalCallback", reqArgs); + return this; } /** Sets the resource status */ - public IResource withStatus(TestResourceStatus status) { + public ParameterResource withStatus(TestResourceStatus status) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("status", AspireClient.serializeValue(status)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withStatus", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withStatus", reqArgs); + return this; } /** Configures with nested DTO */ - public IResource withNestedConfig(TestNestedDto config) { + public ParameterResource withNestedConfig(TestNestedDto config) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("config", AspireClient.serializeValue(config)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withNestedConfig", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withNestedConfig", reqArgs); + return this; } /** Adds validation callback */ - public IResource withValidator(Function validator) { + public ParameterResource withValidator(AspireFunc1 validator) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (validator != null) { - reqArgs.put("validator", getClient().registerCallback(validator)); + var validatorId = getClient().registerCallback(args -> { + var arg = (TestResourceContext) args[0]; + return AspireClient.awaitValue(validator.invoke(arg)); + }); + if (validatorId != null) { + reqArgs.put("validator", validatorId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withValidator", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withValidator", reqArgs); + return this; } /** Waits for another resource (test version) */ - public IResource testWaitFor(IResource dependency) { + public ParameterResource testWaitFor(IResource dependency) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWaitFor", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWaitFor", reqArgs); + return this; + } + + public ParameterResource testWaitFor(ResourceBuilderBase dependency) { + return testWaitFor(new IResource(dependency.getHandle(), dependency.getClient())); } /** Adds a dependency on another resource */ - public IResource withDependency(IResourceWithConnectionString dependency) { + public ParameterResource withDependency(IResourceWithConnectionString dependency) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDependency", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDependency", reqArgs); + return this; } - /** Sets the endpoints */ - public IResource withEndpoints(String[] endpoints) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("endpoints", AspireClient.serializeValue(endpoints)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEndpoints", reqArgs); + public ParameterResource withDependency(ResourceBuilderBase dependency) { + return withDependency(new IResourceWithConnectionString(dependency.getHandle(), dependency.getClient())); } - /** Sets environment variables */ - public IResourceWithEnvironment withEnvironmentVariables(Map variables) { + /** Sets the endpoints */ + public ParameterResource withEndpoints(String[] endpoints) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("variables", AspireClient.serializeValue(variables)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEnvironmentVariables", reqArgs); + reqArgs.put("endpoints", AspireClient.serializeValue(endpoints)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEndpoints", reqArgs); + return this; } /** Performs a cancellable operation */ - public IResource withCancellableOperation(Function operation) { + public ParameterResource withCancellableOperation(AspireAction1 operation) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (operation != null) { - reqArgs.put("operation", getClient().registerCallback(operation)); + var operationId = getClient().registerCallback(args -> { + var arg = CancellationToken.fromValue(args[0]); + operation.invoke(arg); + return null; + }); + if (operationId != null) { + reqArgs.put("operation", operationId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCancellableOperation", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCancellableOperation", reqArgs); + return this; } } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext. */ -class ExecuteCommandContext extends HandleWrapperBase { - ExecuteCommandContext(Handle handle, AspireClient client) { +// ===== PipelineConfigurationContext.java ===== +// PipelineConfigurationContext.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext. */ +public class PipelineConfigurationContext extends HandleWrapperBase { + PipelineConfigurationContext(Handle handle, AspireClient client) { super(handle, client); } - /** Gets the ServiceProvider property */ - public IServiceProvider serviceProvider() { + /** Gets the Services property */ + public IServiceProvider services() { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (IServiceProvider) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ExecuteCommandContext.serviceProvider", reqArgs); + return (IServiceProvider) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineConfigurationContext.services", reqArgs); } - /** Sets the ServiceProvider property */ - public ExecuteCommandContext setServiceProvider(IServiceProvider value) { + /** Sets the Services property */ + public PipelineConfigurationContext setServices(IServiceProvider value) { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); reqArgs.put("value", AspireClient.serializeValue(value)); - return (ExecuteCommandContext) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setServiceProvider", reqArgs); + return (PipelineConfigurationContext) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineConfigurationContext.setServices", reqArgs); } - /** Gets the ResourceName property */ - public String resourceName() { + public PipelineConfigurationContext setServices(HandleWrapperBase value) { + return setServices(new IServiceProvider(value.getHandle(), value.getClient())); + } + + /** Gets the Steps property */ + public PipelineStep[] steps() { + Map reqArgs = new HashMap<>(); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (PipelineStep[]) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps", reqArgs); + } + + /** Sets the Steps property */ + public PipelineConfigurationContext setSteps(PipelineStep[] value) { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (String) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ExecuteCommandContext.resourceName", reqArgs); + reqArgs.put("value", AspireClient.serializeValue(value)); + return (PipelineConfigurationContext) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineConfigurationContext.setSteps", reqArgs); } - /** Sets the ResourceName property */ - public ExecuteCommandContext setResourceName(String value) { + /** Gets the Model property */ + public DistributedApplicationModel model() { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (ExecuteCommandContext) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setResourceName", reqArgs); + return (DistributedApplicationModel) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineConfigurationContext.model", reqArgs); } - /** Gets the CancellationToken property */ - public CancellationToken cancellationToken() { + /** Sets the Model property */ + public PipelineConfigurationContext setModel(DistributedApplicationModel value) { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (CancellationToken) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ExecuteCommandContext.cancellationToken", reqArgs); + reqArgs.put("value", AspireClient.serializeValue(value)); + return (PipelineConfigurationContext) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineConfigurationContext.setModel", reqArgs); } - /** Sets the CancellationToken property */ - public ExecuteCommandContext setCancellationToken(CancellationToken value) { + /** Gets pipeline steps with the specified tag */ + public PipelineStep[] getStepsByTag(String tag) { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); - if (value != null) { - reqArgs.put("value", getClient().registerCancellation(value)); - } - return (ExecuteCommandContext) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ExecuteCommandContext.setCancellationToken", reqArgs); + reqArgs.put("tag", AspireClient.serializeValue(tag)); + return (PipelineStep[]) getClient().invokeCapability("Aspire.Hosting.Pipelines/getStepsByTag", reqArgs); } } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ExternalServiceResource. */ -class ExternalServiceResource extends ResourceBuilderBase { - ExternalServiceResource(Handle handle, AspireClient client) { +// ===== PipelineContext.java ===== +// PipelineContext.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineContext. */ +public class PipelineContext extends HandleWrapperBase { + PipelineContext(Handle handle, AspireClient client) { super(handle, client); } - /** Configures a resource to use a container registry */ - public IResource withContainerRegistry(IResource registry) { + /** Gets the Model property */ + public DistributedApplicationModel model() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("registry", AspireClient.serializeValue(registry)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withContainerRegistry", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (DistributedApplicationModel) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineContext.model", reqArgs); } - /** Sets the base image for a Dockerfile build */ - public IResource withDockerfileBaseImage(String buildImage, String runtimeImage) { + /** Gets the ExecutionContext property */ + public DistributedApplicationExecutionContext executionContext() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (buildImage != null) { - reqArgs.put("buildImage", AspireClient.serializeValue(buildImage)); - } - if (runtimeImage != null) { - reqArgs.put("runtimeImage", AspireClient.serializeValue(runtimeImage)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withDockerfileBaseImage", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (DistributedApplicationExecutionContext) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineContext.executionContext", reqArgs); } - /** Adds an HTTP health check to an external service */ - public ExternalServiceResource withExternalServiceHttpHealthCheck(String path, Double statusCode) { + /** Gets the Services property */ + public IServiceProvider services() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (path != null) { - reqArgs.put("path", AspireClient.serializeValue(path)); - } - if (statusCode != null) { - reqArgs.put("statusCode", AspireClient.serializeValue(statusCode)); - } - return (ExternalServiceResource) getClient().invokeCapability("Aspire.Hosting/withExternalServiceHttpHealthCheck", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (IServiceProvider) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineContext.services", reqArgs); } - /** Adds a required command dependency */ - public IResource withRequiredCommand(String command, String helpLink) { + /** Gets the Logger property */ + public ILogger logger() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("command", AspireClient.serializeValue(command)); - if (helpLink != null) { - reqArgs.put("helpLink", AspireClient.serializeValue(helpLink)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withRequiredCommand", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (ILogger) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineContext.logger", reqArgs); } - /** Customizes displayed URLs via callback */ - public IResource withUrlsCallback(Function callback) { + /** Gets the CancellationToken property */ + public CancellationToken cancellationToken() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlsCallback", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (CancellationToken) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineContext.cancellationToken", reqArgs); } - /** Customizes displayed URLs via async callback */ - public IResource withUrlsCallbackAsync(Function callback) { + /** Sets the CancellationToken property */ + public PipelineContext setCancellationToken(CancellationToken value) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + if (value != null) { + reqArgs.put("value", getClient().registerCancellation(value)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlsCallbackAsync", reqArgs); + return (PipelineContext) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineContext.setCancellationToken", reqArgs); } - /** Adds or modifies displayed URLs */ - public IResource withUrl(String url, String displayText) { + /** Gets the Summary property */ + public PipelineSummary summary() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("url", AspireClient.serializeValue(url)); - if (displayText != null) { - reqArgs.put("displayText", AspireClient.serializeValue(displayText)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrl", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (PipelineSummary) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineContext.summary", reqArgs); } - /** Adds a URL using a reference expression */ - public IResource withUrlExpression(ReferenceExpression url, String displayText) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("url", AspireClient.serializeValue(url)); - if (displayText != null) { - reqArgs.put("displayText", AspireClient.serializeValue(displayText)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlExpression", reqArgs); - } +} - /** Customizes the URL for a specific endpoint via callback */ - public IResource withUrlForEndpoint(String endpointName, Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlForEndpoint", reqArgs); - } +// ===== PipelineStep.java ===== +// PipelineStep.java - GENERATED CODE - DO NOT EDIT - /** Excludes the resource from the deployment manifest */ - public IResource excludeFromManifest() { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/excludeFromManifest", reqArgs); - } +package aspire; - /** Prevents resource from starting automatically */ - public IResource withExplicitStart() { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withExplicitStart", reqArgs); +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep. */ +public class PipelineStep extends HandleWrapperBase { + PipelineStep(Handle handle, AspireClient client) { + super(handle, client); } - /** Adds a health check by key */ - public IResource withHealthCheck(String key) { + /** Gets the Name property */ + public String name() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("key", AspireClient.serializeValue(key)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withHealthCheck", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (String) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStep.name", reqArgs); } - /** Adds a resource command */ - public IResource withCommand(String name, String displayName, Function executeCommand, CommandOptions commandOptions) { + /** Sets the Name property */ + public PipelineStep setName(String value) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("displayName", AspireClient.serializeValue(displayName)); - if (executeCommand != null) { - reqArgs.put("executeCommand", getClient().registerCallback(executeCommand)); - } - if (commandOptions != null) { - reqArgs.put("commandOptions", AspireClient.serializeValue(commandOptions)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withCommand", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + reqArgs.put("value", AspireClient.serializeValue(value)); + return (PipelineStep) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStep.setName", reqArgs); } - /** Sets the parent relationship */ - public IResource withParentRelationship(IResource parent) { + /** Gets the Description property */ + public String description() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("parent", AspireClient.serializeValue(parent)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withParentRelationship", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (String) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStep.description", reqArgs); } - /** Sets a child relationship */ - public IResource withChildRelationship(IResource child) { + /** Sets the Description property */ + public PipelineStep setDescription(String value) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("child", AspireClient.serializeValue(child)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withChildRelationship", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + reqArgs.put("value", AspireClient.serializeValue(value)); + return (PipelineStep) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStep.setDescription", reqArgs); } - /** Sets the icon for the resource */ - public IResource withIconName(String iconName, IconVariant iconVariant) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("iconName", AspireClient.serializeValue(iconName)); - if (iconVariant != null) { - reqArgs.put("iconVariant", AspireClient.serializeValue(iconVariant)); + /** Gets the DependsOnSteps property */ + private AspireList dependsOnStepsField; + public AspireList dependsOnSteps() { + if (dependsOnStepsField == null) { + dependsOnStepsField = new AspireList<>(getHandle(), getClient(), "Aspire.Hosting.Pipelines/PipelineStep.dependsOnSteps"); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withIconName", reqArgs); + return dependsOnStepsField; } - /** Excludes the resource from MCP server exposure */ - public IResource excludeFromMcp() { + /** Sets the DependsOnSteps property */ + public PipelineStep setDependsOnSteps(AspireList value) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/excludeFromMcp", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + reqArgs.put("value", AspireClient.serializeValue(value)); + return (PipelineStep) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStep.setDependsOnSteps", reqArgs); } - /** Adds a pipeline step to the resource */ - public IResource withPipelineStepFactory(String stepName, Function callback, String[] dependsOn, String[] requiredBy, String[] tags, String description) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("stepName", AspireClient.serializeValue(stepName)); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - if (dependsOn != null) { - reqArgs.put("dependsOn", AspireClient.serializeValue(dependsOn)); - } - if (requiredBy != null) { - reqArgs.put("requiredBy", AspireClient.serializeValue(requiredBy)); - } - if (tags != null) { - reqArgs.put("tags", AspireClient.serializeValue(tags)); - } - if (description != null) { - reqArgs.put("description", AspireClient.serializeValue(description)); + /** Gets the RequiredBySteps property */ + private AspireList requiredByStepsField; + public AspireList requiredBySteps() { + if (requiredByStepsField == null) { + requiredByStepsField = new AspireList<>(getHandle(), getClient(), "Aspire.Hosting.Pipelines/PipelineStep.requiredBySteps"); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withPipelineStepFactory", reqArgs); + return requiredByStepsField; } - /** Configures pipeline step dependencies via an async callback */ - public IResource withPipelineConfigurationAsync(Function callback) { + /** Sets the RequiredBySteps property */ + public PipelineStep setRequiredBySteps(AspireList value) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withPipelineConfigurationAsync", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + reqArgs.put("value", AspireClient.serializeValue(value)); + return (PipelineStep) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStep.setRequiredBySteps", reqArgs); } - /** Configures pipeline step dependencies via a callback */ - public IResource withPipelineConfiguration(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + /** Gets the Tags property */ + private AspireList tagsField; + public AspireList tags() { + if (tagsField == null) { + tagsField = new AspireList<>(getHandle(), getClient(), "Aspire.Hosting.Pipelines/PipelineStep.tags"); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withPipelineConfiguration", reqArgs); + return tagsField; } - /** Gets the resource name */ - public String getResourceName() { + /** Sets the Tags property */ + public PipelineStep setTags(AspireList value) { Map reqArgs = new HashMap<>(); - reqArgs.put("resource", AspireClient.serializeValue(getHandle())); - return (String) getClient().invokeCapability("Aspire.Hosting/getResourceName", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + reqArgs.put("value", AspireClient.serializeValue(value)); + return (PipelineStep) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStep.setTags", reqArgs); } - /** Subscribes to the BeforeResourceStarted event */ - public IResource onBeforeResourceStarted(Function callback) { + /** Gets the Resource property */ + public IResource resource() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onBeforeResourceStarted", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (IResource) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStep.resource", reqArgs); } - /** Subscribes to the ResourceStopped event */ - public IResource onResourceStopped(Function callback) { + /** Sets the Resource property */ + public PipelineStep setResource(IResource value) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onResourceStopped", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + reqArgs.put("value", AspireClient.serializeValue(value)); + return (PipelineStep) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStep.setResource", reqArgs); } - /** Subscribes to the InitializeResource event */ - public IResource onInitializeResource(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onInitializeResource", reqArgs); + public PipelineStep setResource(ResourceBuilderBase value) { + return setResource(new IResource(value.getHandle(), value.getClient())); } - /** Subscribes to the ResourceReady event */ - public IResource onResourceReady(Function callback) { + /** Adds a dependency on another step by name */ + public void dependsOn(String stepName) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onResourceReady", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + reqArgs.put("stepName", AspireClient.serializeValue(stepName)); + getClient().invokeCapability("Aspire.Hosting.Pipelines/dependsOn", reqArgs); } - /** Adds an optional string parameter */ - public IResource withOptionalString(String value, Boolean enabled) { + /** Specifies that another step requires this step by name */ + public void requiredBy(String stepName) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (value != null) { - reqArgs.put("value", AspireClient.serializeValue(value)); - } - if (enabled != null) { - reqArgs.put("enabled", AspireClient.serializeValue(enabled)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalString", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + reqArgs.put("stepName", AspireClient.serializeValue(stepName)); + getClient().invokeCapability("Aspire.Hosting.Pipelines/requiredBy", reqArgs); } - /** Configures the resource with a DTO */ - public IResource withConfig(TestConfigDto config) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("config", AspireClient.serializeValue(config)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConfig", reqArgs); +} + +// ===== PipelineStepContext.java ===== +// PipelineStepContext.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext. */ +public class PipelineStepContext extends HandleWrapperBase { + PipelineStepContext(Handle handle, AspireClient client) { + super(handle, client); } - /** Sets the created timestamp */ - public IResource withCreatedAt(String createdAt) { + /** Gets the PipelineContext property */ + public PipelineContext pipelineContext() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("createdAt", AspireClient.serializeValue(createdAt)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCreatedAt", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (PipelineContext) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStepContext.pipelineContext", reqArgs); } - /** Sets the modified timestamp */ - public IResource withModifiedAt(String modifiedAt) { + /** Sets the PipelineContext property */ + public PipelineStepContext setPipelineContext(PipelineContext value) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("modifiedAt", AspireClient.serializeValue(modifiedAt)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withModifiedAt", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + reqArgs.put("value", AspireClient.serializeValue(value)); + return (PipelineStepContext) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStepContext.setPipelineContext", reqArgs); } - /** Sets the correlation ID */ - public IResource withCorrelationId(String correlationId) { + /** Gets the ReportingStep property */ + public IReportingStep reportingStep() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("correlationId", AspireClient.serializeValue(correlationId)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCorrelationId", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (IReportingStep) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStepContext.reportingStep", reqArgs); } - /** Configures with optional callback */ - public IResource withOptionalCallback(Function callback) { + /** Sets the ReportingStep property */ + public PipelineStepContext setReportingStep(IReportingStep value) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalCallback", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + reqArgs.put("value", AspireClient.serializeValue(value)); + return (PipelineStepContext) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStepContext.setReportingStep", reqArgs); } - /** Sets the resource status */ - public IResource withStatus(TestResourceStatus status) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("status", AspireClient.serializeValue(status)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withStatus", reqArgs); + public PipelineStepContext setReportingStep(HandleWrapperBase value) { + return setReportingStep(new IReportingStep(value.getHandle(), value.getClient())); } - /** Configures with nested DTO */ - public IResource withNestedConfig(TestNestedDto config) { + /** Gets the Model property */ + public DistributedApplicationModel model() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("config", AspireClient.serializeValue(config)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withNestedConfig", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (DistributedApplicationModel) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStepContext.model", reqArgs); } - /** Adds validation callback */ - public IResource withValidator(Function validator) { + /** Gets the ExecutionContext property */ + public DistributedApplicationExecutionContext executionContext() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (validator != null) { - reqArgs.put("validator", getClient().registerCallback(validator)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withValidator", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (DistributedApplicationExecutionContext) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStepContext.executionContext", reqArgs); } - /** Waits for another resource (test version) */ - public IResource testWaitFor(IResource dependency) { + /** Gets the Services property */ + public IServiceProvider services() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWaitFor", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (IServiceProvider) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStepContext.services", reqArgs); } - /** Adds a dependency on another resource */ - public IResource withDependency(IResourceWithConnectionString dependency) { + /** Gets the Logger property */ + public ILogger logger() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDependency", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (ILogger) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStepContext.logger", reqArgs); } - /** Sets the endpoints */ - public IResource withEndpoints(String[] endpoints) { + /** Gets the CancellationToken property */ + public CancellationToken cancellationToken() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("endpoints", AspireClient.serializeValue(endpoints)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEndpoints", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (CancellationToken) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStepContext.cancellationToken", reqArgs); } - /** Performs a cancellable operation */ - public IResource withCancellableOperation(Function operation) { + /** Gets the Summary property */ + public PipelineSummary summary() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (operation != null) { - reqArgs.put("operation", getClient().registerCallback(operation)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCancellableOperation", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (PipelineSummary) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStepContext.summary", reqArgs); } } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource. */ -class IComputeResource extends HandleWrapperBase { - IComputeResource(Handle handle, AspireClient client) { - super(handle, client); - } +// ===== PipelineStepFactoryContext.java ===== +// PipelineStepFactoryContext.java - GENERATED CODE - DO NOT EDIT -} +package aspire; -/** Wrapper for Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration. */ -class IConfiguration extends HandleWrapperBase { - IConfiguration(Handle handle, AspireClient client) { +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepFactoryContext. */ +public class PipelineStepFactoryContext extends HandleWrapperBase { + PipelineStepFactoryContext(Handle handle, AspireClient client) { super(handle, client); } - /** Gets a configuration value by key */ - public String getConfigValue(String key) { + /** Gets the PipelineContext property */ + public PipelineContext pipelineContext() { Map reqArgs = new HashMap<>(); - reqArgs.put("configuration", AspireClient.serializeValue(getHandle())); - reqArgs.put("key", AspireClient.serializeValue(key)); - return (String) getClient().invokeCapability("Aspire.Hosting/getConfigValue", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (PipelineContext) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStepFactoryContext.pipelineContext", reqArgs); } - /** Gets a connection string by name */ - public String getConnectionString(String name) { + /** Sets the PipelineContext property */ + public PipelineStepFactoryContext setPipelineContext(PipelineContext value) { Map reqArgs = new HashMap<>(); - reqArgs.put("configuration", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - return (String) getClient().invokeCapability("Aspire.Hosting/getConnectionString", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + reqArgs.put("value", AspireClient.serializeValue(value)); + return (PipelineStepFactoryContext) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStepFactoryContext.setPipelineContext", reqArgs); } - /** Gets a configuration section by key */ - public IConfigurationSection getSection(String key) { + /** Gets the Resource property */ + public IResource resource() { Map reqArgs = new HashMap<>(); - reqArgs.put("configuration", AspireClient.serializeValue(getHandle())); - reqArgs.put("key", AspireClient.serializeValue(key)); - return (IConfigurationSection) getClient().invokeCapability("Aspire.Hosting/getSection", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (IResource) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStepFactoryContext.resource", reqArgs); } - /** Gets child configuration sections */ - public IConfigurationSection[] getChildren() { + /** Sets the Resource property */ + public PipelineStepFactoryContext setResource(IResource value) { Map reqArgs = new HashMap<>(); - reqArgs.put("configuration", AspireClient.serializeValue(getHandle())); - return (IConfigurationSection[]) getClient().invokeCapability("Aspire.Hosting/getChildren", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + reqArgs.put("value", AspireClient.serializeValue(value)); + return (PipelineStepFactoryContext) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStepFactoryContext.setResource", reqArgs); } - /** Checks whether a configuration section exists */ - public boolean exists(String key) { - Map reqArgs = new HashMap<>(); - reqArgs.put("configuration", AspireClient.serializeValue(getHandle())); - reqArgs.put("key", AspireClient.serializeValue(key)); - return (boolean) getClient().invokeCapability("Aspire.Hosting/exists", reqArgs); + public PipelineStepFactoryContext setResource(ResourceBuilderBase value) { + return setResource(new IResource(value.getHandle(), value.getClient())); } } -/** Wrapper for Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfigurationSection. */ -class IConfigurationSection extends HandleWrapperBase { - IConfigurationSection(Handle handle, AspireClient client) { - super(handle, client); - } - -} +// ===== PipelineSummary.java ===== +// PipelineSummary.java - GENERATED CODE - DO NOT EDIT -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource. */ -class IContainerFilesDestinationResource extends HandleWrapperBase { - IContainerFilesDestinationResource(Handle handle, AspireClient client) { - super(handle, client); - } +package aspire; -} +import java.util.*; +import java.util.function.*; -/** Wrapper for Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder. */ -class IDistributedApplicationBuilder extends HandleWrapperBase { - IDistributedApplicationBuilder(Handle handle, AspireClient client) { +/** Wrapper for Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineSummary. */ +public class PipelineSummary extends HandleWrapperBase { + PipelineSummary(Handle handle, AspireClient client) { super(handle, client); } - /** Adds a connection string with a reference expression */ - public ConnectionStringResource addConnectionStringExpression(String name, ReferenceExpression connectionStringExpression) { + /** Invokes the Add method */ + public void add(String key, String value) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("connectionStringExpression", AspireClient.serializeValue(connectionStringExpression)); - return (ConnectionStringResource) getClient().invokeCapability("Aspire.Hosting/addConnectionStringExpression", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + reqArgs.put("key", AspireClient.serializeValue(key)); + reqArgs.put("value", AspireClient.serializeValue(value)); + getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineSummary.add", reqArgs); } - /** Adds a connection string with a builder callback */ - public ConnectionStringResource addConnectionStringBuilder(String name, Function connectionStringBuilder) { + /** Adds a Markdown-formatted value to the pipeline summary */ + public void addMarkdown(String key, String markdownString) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - if (connectionStringBuilder != null) { - reqArgs.put("connectionStringBuilder", getClient().registerCallback(connectionStringBuilder)); - } - return (ConnectionStringResource) getClient().invokeCapability("Aspire.Hosting/addConnectionStringBuilder", reqArgs); + reqArgs.put("summary", AspireClient.serializeValue(getHandle())); + reqArgs.put("key", AspireClient.serializeValue(key)); + reqArgs.put("markdownString", AspireClient.serializeValue(markdownString)); + getClient().invokeCapability("Aspire.Hosting/addMarkdown", reqArgs); } - /** Adds a container registry resource */ - public ContainerRegistryResource addContainerRegistry(String name, ParameterResource endpoint, ParameterResource repository) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("endpoint", AspireClient.serializeValue(endpoint)); - if (repository != null) { - reqArgs.put("repository", AspireClient.serializeValue(repository)); - } - return (ContainerRegistryResource) getClient().invokeCapability("Aspire.Hosting/addContainerRegistry", reqArgs); - } +} - /** Adds a container registry with string endpoint */ - public ContainerRegistryResource addContainerRegistryFromString(String name, String endpoint, String repository) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("endpoint", AspireClient.serializeValue(endpoint)); - if (repository != null) { - reqArgs.put("repository", AspireClient.serializeValue(repository)); - } - return (ContainerRegistryResource) getClient().invokeCapability("Aspire.Hosting/addContainerRegistryFromString", reqArgs); - } +// ===== ProbeType.java ===== +// ProbeType.java - GENERATED CODE - DO NOT EDIT - /** Adds a container resource */ - public ContainerResource addContainer(String name, String image) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("image", AspireClient.serializeValue(image)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/addContainer", reqArgs); - } +package aspire; - /** Adds a container resource built from a Dockerfile */ - public ContainerResource addDockerfile(String name, String contextPath, String dockerfilePath, String stage) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("contextPath", AspireClient.serializeValue(contextPath)); - if (dockerfilePath != null) { - reqArgs.put("dockerfilePath", AspireClient.serializeValue(dockerfilePath)); - } - if (stage != null) { - reqArgs.put("stage", AspireClient.serializeValue(stage)); - } - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/addDockerfile", reqArgs); - } +import java.util.*; +import java.util.function.*; + +/** ProbeType enum. */ +public enum ProbeType implements WireValueEnum { + STARTUP("Startup"), + READINESS("Readiness"), + LIVENESS("Liveness"); - /** Adds a .NET tool resource */ - public DotnetToolResource addDotnetTool(String name, String packageId) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("packageId", AspireClient.serializeValue(packageId)); - return (DotnetToolResource) getClient().invokeCapability("Aspire.Hosting/addDotnetTool", reqArgs); - } + private final String value; - /** Adds an executable resource */ - public ExecutableResource addExecutable(String name, String command, String workingDirectory, String[] args) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("command", AspireClient.serializeValue(command)); - reqArgs.put("workingDirectory", AspireClient.serializeValue(workingDirectory)); - reqArgs.put("args", AspireClient.serializeValue(args)); - return (ExecutableResource) getClient().invokeCapability("Aspire.Hosting/addExecutable", reqArgs); + ProbeType(String value) { + this.value = value; } - /** Adds an external service resource */ - public ExternalServiceResource addExternalService(String name, String url) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("url", AspireClient.serializeValue(url)); - return (ExternalServiceResource) getClient().invokeCapability("Aspire.Hosting/addExternalService", reqArgs); + public String getValue() { return value; } + + public static ProbeType fromValue(String value) { + for (ProbeType e : values()) { + if (e.value.equals(value)) return e; + } + throw new IllegalArgumentException("Unknown value: " + value); } +} - /** Adds an external service with a URI */ - public ExternalServiceResource addExternalServiceUri(String name, String uri) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("uri", AspireClient.serializeValue(uri)); - return (ExternalServiceResource) getClient().invokeCapability("Aspire.Hosting/addExternalServiceUri", reqArgs); +// ===== ProjectResource.java ===== +// ProjectResource.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource. */ +public class ProjectResource extends ResourceBuilderBase { + ProjectResource(Handle handle, AspireClient client) { + super(handle, client); } - /** Adds an external service with a parameter URL */ - public ExternalServiceResource addExternalServiceParameter(String name, ParameterResource urlParameter) { + /** Configures a resource to use a container registry */ + public ProjectResource withContainerRegistry(IResource registry) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("urlParameter", AspireClient.serializeValue(urlParameter)); - return (ExternalServiceResource) getClient().invokeCapability("Aspire.Hosting/addExternalServiceParameter", reqArgs); + reqArgs.put("registry", AspireClient.serializeValue(registry)); + getClient().invokeCapability("Aspire.Hosting/withContainerRegistry", reqArgs); + return this; } - /** Gets the AppHostDirectory property */ - public String appHostDirectory() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (String) getClient().invokeCapability("Aspire.Hosting/IDistributedApplicationBuilder.appHostDirectory", reqArgs); + public ProjectResource withContainerRegistry(ResourceBuilderBase registry) { + return withContainerRegistry(new IResource(registry.getHandle(), registry.getClient())); } - /** Gets the Environment property */ - public IHostEnvironment environment() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (IHostEnvironment) getClient().invokeCapability("Aspire.Hosting/IDistributedApplicationBuilder.environment", reqArgs); + /** Sets the base image for a Dockerfile build */ + public ProjectResource withDockerfileBaseImage(WithDockerfileBaseImageOptions options) { + var buildImage = options == null ? null : options.getBuildImage(); + var runtimeImage = options == null ? null : options.getRuntimeImage(); + return withDockerfileBaseImageImpl(buildImage, runtimeImage); } - /** Gets the Eventing property */ - public IDistributedApplicationEventing eventing() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (IDistributedApplicationEventing) getClient().invokeCapability("Aspire.Hosting/IDistributedApplicationBuilder.eventing", reqArgs); + public ProjectResource withDockerfileBaseImage() { + return withDockerfileBaseImage(null); } - /** Gets the ExecutionContext property */ - public DistributedApplicationExecutionContext executionContext() { + /** Sets the base image for a Dockerfile build */ + private ProjectResource withDockerfileBaseImageImpl(String buildImage, String runtimeImage) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (DistributedApplicationExecutionContext) getClient().invokeCapability("Aspire.Hosting/IDistributedApplicationBuilder.executionContext", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + if (buildImage != null) { + reqArgs.put("buildImage", AspireClient.serializeValue(buildImage)); + } + if (runtimeImage != null) { + reqArgs.put("runtimeImage", AspireClient.serializeValue(runtimeImage)); + } + getClient().invokeCapability("Aspire.Hosting/withDockerfileBaseImage", reqArgs); + return this; } - /** Gets the UserSecretsManager property */ - public IUserSecretsManager userSecretsManager() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (IUserSecretsManager) getClient().invokeCapability("Aspire.Hosting/IDistributedApplicationBuilder.userSecretsManager", reqArgs); + /** Configures an MCP server endpoint on the resource */ + public ProjectResource withMcpServer(WithMcpServerOptions options) { + var path = options == null ? null : options.getPath(); + var endpointName = options == null ? null : options.getEndpointName(); + return withMcpServerImpl(path, endpointName); } - /** Builds the distributed application */ - public DistributedApplication build() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (DistributedApplication) getClient().invokeCapability("Aspire.Hosting/build", reqArgs); + public ProjectResource withMcpServer() { + return withMcpServer(null); } - /** Adds a parameter resource */ - public ParameterResource addParameter(String name, Boolean secret) { + /** Configures an MCP server endpoint on the resource */ + private ProjectResource withMcpServerImpl(String path, String endpointName) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - if (secret != null) { - reqArgs.put("secret", AspireClient.serializeValue(secret)); + if (path != null) { + reqArgs.put("path", AspireClient.serializeValue(path)); } - return (ParameterResource) getClient().invokeCapability("Aspire.Hosting/addParameter", reqArgs); + if (endpointName != null) { + reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + } + getClient().invokeCapability("Aspire.Hosting/withMcpServer", reqArgs); + return this; } - /** Adds a parameter with a default value */ - public ParameterResource addParameterWithValue(String name, String value, Boolean publishValueAsDefault, Boolean secret) { + /** Configures OTLP telemetry export */ + public ProjectResource withOtlpExporter() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("value", AspireClient.serializeValue(value)); - if (publishValueAsDefault != null) { - reqArgs.put("publishValueAsDefault", AspireClient.serializeValue(publishValueAsDefault)); - } - if (secret != null) { - reqArgs.put("secret", AspireClient.serializeValue(secret)); - } - return (ParameterResource) getClient().invokeCapability("Aspire.Hosting/addParameterWithValue", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withOtlpExporter", reqArgs); + return this; } - /** Adds a parameter sourced from configuration */ - public ParameterResource addParameterFromConfiguration(String name, String configurationKey, Boolean secret) { + /** Configures OTLP telemetry export with specific protocol */ + public ProjectResource withOtlpExporterProtocol(OtlpProtocol protocol) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("configurationKey", AspireClient.serializeValue(configurationKey)); - if (secret != null) { - reqArgs.put("secret", AspireClient.serializeValue(secret)); - } - return (ParameterResource) getClient().invokeCapability("Aspire.Hosting/addParameterFromConfiguration", reqArgs); + reqArgs.put("protocol", AspireClient.serializeValue(protocol)); + getClient().invokeCapability("Aspire.Hosting/withOtlpExporterProtocol", reqArgs); + return this; } - /** Adds a connection string resource */ - public IResourceWithConnectionString addConnectionString(String name, String environmentVariableName) { + /** Sets the number of replicas */ + public ProjectResource withReplicas(double replicas) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - if (environmentVariableName != null) { - reqArgs.put("environmentVariableName", AspireClient.serializeValue(environmentVariableName)); - } - return (IResourceWithConnectionString) getClient().invokeCapability("Aspire.Hosting/addConnectionString", reqArgs); + reqArgs.put("replicas", AspireClient.serializeValue(replicas)); + getClient().invokeCapability("Aspire.Hosting/withReplicas", reqArgs); + return this; } - /** Adds a .NET project resource */ - public ProjectResource addProject(String name, String projectPath, String launchProfileName) { + /** Disables forwarded headers for the project */ + public ProjectResource disableForwardedHeaders() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("projectPath", AspireClient.serializeValue(projectPath)); - reqArgs.put("launchProfileName", AspireClient.serializeValue(launchProfileName)); - return (ProjectResource) getClient().invokeCapability("Aspire.Hosting/addProject", reqArgs); + getClient().invokeCapability("Aspire.Hosting/disableForwardedHeaders", reqArgs); + return this; } - /** Adds a project resource with configuration options */ - public ProjectResource addProjectWithOptions(String name, String projectPath, Function configure) { + public ProjectResource publishAsDockerFile() { + return publishAsDockerFile(null); + } + + /** Publishes a project as a Docker file with optional container configuration */ + public ProjectResource publishAsDockerFile(AspireAction1 configure) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("projectPath", AspireClient.serializeValue(projectPath)); - if (configure != null) { - reqArgs.put("configure", getClient().registerCallback(configure)); + var configureId = configure == null ? null : getClient().registerCallback(args -> { + var obj = (ContainerResource) args[0]; + configure.invoke(obj); + return null; + }); + if (configureId != null) { + reqArgs.put("configure", configureId); } - return (ProjectResource) getClient().invokeCapability("Aspire.Hosting/addProjectWithOptions", reqArgs); + getClient().invokeCapability("Aspire.Hosting/publishProjectAsDockerFileWithConfigure", reqArgs); + return this; } - /** Adds a C# application resource */ - public ProjectResource addCSharpApp(String name, String path) { + public ProjectResource withRequiredCommand(String command) { + return withRequiredCommand(command, null); + } + + /** Adds a required command dependency */ + public ProjectResource withRequiredCommand(String command, String helpLink) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("path", AspireClient.serializeValue(path)); - return (ProjectResource) getClient().invokeCapability("Aspire.Hosting/addCSharpApp", reqArgs); + reqArgs.put("command", AspireClient.serializeValue(command)); + if (helpLink != null) { + reqArgs.put("helpLink", AspireClient.serializeValue(helpLink)); + } + getClient().invokeCapability("Aspire.Hosting/withRequiredCommand", reqArgs); + return this; } - /** Adds a C# application resource with configuration options */ - public CSharpAppResource addCSharpAppWithOptions(String name, String path, Function configure) { + /** Sets an environment variable */ + public ProjectResource withEnvironment(String name, String value) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("path", AspireClient.serializeValue(path)); - if (configure != null) { - reqArgs.put("configure", getClient().registerCallback(configure)); - } - return (CSharpAppResource) getClient().invokeCapability("Aspire.Hosting/addCSharpAppWithOptions", reqArgs); + reqArgs.put("value", AspireClient.serializeValue(value)); + getClient().invokeCapability("Aspire.Hosting/withEnvironment", reqArgs); + return this; } - /** Gets the application configuration */ - public IConfiguration getConfiguration() { + /** Adds an environment variable with a reference expression */ + public ProjectResource withEnvironmentExpression(String name, ReferenceExpression value) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IConfiguration) getClient().invokeCapability("Aspire.Hosting/getConfiguration", reqArgs); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("value", AspireClient.serializeValue(value)); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentExpression", reqArgs); + return this; } - /** Subscribes to the BeforeStart event */ - public DistributedApplicationEventSubscription subscribeBeforeStart(Function callback) { + /** Sets environment variables via callback */ + public ProjectResource withEnvironmentCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var obj = (EnvironmentCallbackContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (DistributedApplicationEventSubscription) getClient().invokeCapability("Aspire.Hosting/subscribeBeforeStart", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentCallback", reqArgs); + return this; } - /** Subscribes to the AfterResourcesCreated event */ - public DistributedApplicationEventSubscription subscribeAfterResourcesCreated(Function callback) { + /** Sets environment variables via async callback */ + public ProjectResource withEnvironmentCallbackAsync(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var arg = (EnvironmentCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (DistributedApplicationEventSubscription) getClient().invokeCapability("Aspire.Hosting/subscribeAfterResourcesCreated", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentCallbackAsync", reqArgs); + return this; } - /** Adds a test Redis resource */ - public TestRedisResource addTestRedis(String name, Double port) { + /** Sets an environment variable from an endpoint reference */ + public ProjectResource withEnvironmentEndpoint(String name, EndpointReference endpointReference) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("name", AspireClient.serializeValue(name)); - if (port != null) { - reqArgs.put("port", AspireClient.serializeValue(port)); - } - return (TestRedisResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/addTestRedis", reqArgs); + reqArgs.put("endpointReference", AspireClient.serializeValue(endpointReference)); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentEndpoint", reqArgs); + return this; } - /** Adds a test vault resource */ - public TestVaultResource addTestVault(String name) { + /** Sets an environment variable from a parameter resource */ + public ProjectResource withEnvironmentParameter(String name, ParameterResource parameter) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("name", AspireClient.serializeValue(name)); - return (TestVaultResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/addTestVault", reqArgs); - } - -} - -/** Wrapper for Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEvent. */ -class IDistributedApplicationEvent extends HandleWrapperBase { - IDistributedApplicationEvent(Handle handle, AspireClient client) { - super(handle, client); - } - -} - -/** Wrapper for Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing. */ -class IDistributedApplicationEventing extends HandleWrapperBase { - IDistributedApplicationEventing(Handle handle, AspireClient client) { - super(handle, client); + reqArgs.put("parameter", AspireClient.serializeValue(parameter)); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentParameter", reqArgs); + return this; } - /** Invokes the Unsubscribe method */ - public void unsubscribe(DistributedApplicationEventSubscription subscription) { + /** Sets an environment variable from a connection string resource */ + public ProjectResource withEnvironmentConnectionString(String envVarName, IResourceWithConnectionString resource) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - reqArgs.put("subscription", AspireClient.serializeValue(subscription)); - getClient().invokeCapability("Aspire.Hosting.Eventing/IDistributedApplicationEventing.unsubscribe", reqArgs); - } - -} - -/** Wrapper for Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationResourceEvent. */ -class IDistributedApplicationResourceEvent extends HandleWrapperBase { - IDistributedApplicationResourceEvent(Handle handle, AspireClient client) { - super(handle, client); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("envVarName", AspireClient.serializeValue(envVarName)); + reqArgs.put("resource", AspireClient.serializeValue(resource)); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentConnectionString", reqArgs); + return this; } -} - -/** Wrapper for Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment. */ -class IHostEnvironment extends HandleWrapperBase { - IHostEnvironment(Handle handle, AspireClient client) { - super(handle, client); + public ProjectResource withEnvironmentConnectionString(String envVarName, ResourceBuilderBase resource) { + return withEnvironmentConnectionString(envVarName, new IResourceWithConnectionString(resource.getHandle(), resource.getClient())); } - /** Checks if running in Development environment */ - public boolean isDevelopment() { + /** Adds arguments */ + public ProjectResource withArgs(String[] args) { Map reqArgs = new HashMap<>(); - reqArgs.put("environment", AspireClient.serializeValue(getHandle())); - return (boolean) getClient().invokeCapability("Aspire.Hosting/isDevelopment", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("args", AspireClient.serializeValue(args)); + getClient().invokeCapability("Aspire.Hosting/withArgs", reqArgs); + return this; } - /** Checks if running in Production environment */ - public boolean isProduction() { + /** Sets command-line arguments via callback */ + public ProjectResource withArgsCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); - reqArgs.put("environment", AspireClient.serializeValue(getHandle())); - return (boolean) getClient().invokeCapability("Aspire.Hosting/isProduction", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var obj = (CommandLineArgsCallbackContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withArgsCallback", reqArgs); + return this; } - /** Checks if running in Staging environment */ - public boolean isStaging() { + /** Sets command-line arguments via async callback */ + public ProjectResource withArgsCallbackAsync(AspireAction1 callback) { Map reqArgs = new HashMap<>(); - reqArgs.put("environment", AspireClient.serializeValue(getHandle())); - return (boolean) getClient().invokeCapability("Aspire.Hosting/isStaging", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (CommandLineArgsCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withArgsCallbackAsync", reqArgs); + return this; } - /** Checks if the environment matches the specified name */ - public boolean isEnvironment(String environmentName) { - Map reqArgs = new HashMap<>(); - reqArgs.put("environment", AspireClient.serializeValue(getHandle())); - reqArgs.put("environmentName", AspireClient.serializeValue(environmentName)); - return (boolean) getClient().invokeCapability("Aspire.Hosting/isEnvironment", reqArgs); + /** Adds a reference to another resource */ + public ProjectResource withReference(IResource source, WithReferenceOptions options) { + var connectionName = options == null ? null : options.getConnectionName(); + var optional = options == null ? null : options.getOptional(); + var name = options == null ? null : options.getName(); + return withReferenceImpl(source, connectionName, optional, name); } -} + public ProjectResource withReference(ResourceBuilderBase source, WithReferenceOptions options) { + return withReference(new IResource(source.getHandle(), source.getClient()), options); + } -/** Wrapper for Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger. */ -class ILogger extends HandleWrapperBase { - ILogger(Handle handle, AspireClient client) { - super(handle, client); + public ProjectResource withReference(IResource source) { + return withReference(source, null); } - /** Logs an information message */ - public void logInformation(String message) { - Map reqArgs = new HashMap<>(); - reqArgs.put("logger", AspireClient.serializeValue(getHandle())); - reqArgs.put("message", AspireClient.serializeValue(message)); - getClient().invokeCapability("Aspire.Hosting/logInformation", reqArgs); + public ProjectResource withReference(ResourceBuilderBase source) { + return withReference(new IResource(source.getHandle(), source.getClient())); } - /** Logs a warning message */ - public void logWarning(String message) { + /** Adds a reference to another resource */ + private ProjectResource withReferenceImpl(IResource source, String connectionName, Boolean optional, String name) { Map reqArgs = new HashMap<>(); - reqArgs.put("logger", AspireClient.serializeValue(getHandle())); - reqArgs.put("message", AspireClient.serializeValue(message)); - getClient().invokeCapability("Aspire.Hosting/logWarning", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("source", AspireClient.serializeValue(source)); + if (connectionName != null) { + reqArgs.put("connectionName", AspireClient.serializeValue(connectionName)); + } + if (optional != null) { + reqArgs.put("optional", AspireClient.serializeValue(optional)); + } + if (name != null) { + reqArgs.put("name", AspireClient.serializeValue(name)); + } + getClient().invokeCapability("Aspire.Hosting/withReference", reqArgs); + return this; } - /** Logs an error message */ - public void logError(String message) { + /** Adds a reference to a URI */ + public ProjectResource withReferenceUri(String name, String uri) { Map reqArgs = new HashMap<>(); - reqArgs.put("logger", AspireClient.serializeValue(getHandle())); - reqArgs.put("message", AspireClient.serializeValue(message)); - getClient().invokeCapability("Aspire.Hosting/logError", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("uri", AspireClient.serializeValue(uri)); + getClient().invokeCapability("Aspire.Hosting/withReferenceUri", reqArgs); + return this; } - /** Logs a debug message */ - public void logDebug(String message) { + /** Adds a reference to an external service */ + public ProjectResource withReferenceExternalService(ExternalServiceResource externalService) { Map reqArgs = new HashMap<>(); - reqArgs.put("logger", AspireClient.serializeValue(getHandle())); - reqArgs.put("message", AspireClient.serializeValue(message)); - getClient().invokeCapability("Aspire.Hosting/logDebug", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("externalService", AspireClient.serializeValue(externalService)); + getClient().invokeCapability("Aspire.Hosting/withReferenceExternalService", reqArgs); + return this; } - /** Logs a message with specified level */ - public void log(String level, String message) { + /** Adds a reference to an endpoint */ + public ProjectResource withReferenceEndpoint(EndpointReference endpointReference) { Map reqArgs = new HashMap<>(); - reqArgs.put("logger", AspireClient.serializeValue(getHandle())); - reqArgs.put("level", AspireClient.serializeValue(level)); - reqArgs.put("message", AspireClient.serializeValue(message)); - getClient().invokeCapability("Aspire.Hosting/log", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("endpointReference", AspireClient.serializeValue(endpointReference)); + getClient().invokeCapability("Aspire.Hosting/withReferenceEndpoint", reqArgs); + return this; } -} + /** Adds a network endpoint */ + public ProjectResource withEndpoint(WithEndpointOptions options) { + var port = options == null ? null : options.getPort(); + var targetPort = options == null ? null : options.getTargetPort(); + var scheme = options == null ? null : options.getScheme(); + var name = options == null ? null : options.getName(); + var env = options == null ? null : options.getEnv(); + var isProxied = options == null ? null : options.isProxied(); + var isExternal = options == null ? null : options.isExternal(); + var protocol = options == null ? null : options.getProtocol(); + return withEndpointImpl(port, targetPort, scheme, name, env, isProxied, isExternal, protocol); + } -/** Wrapper for Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILoggerFactory. */ -class ILoggerFactory extends HandleWrapperBase { - ILoggerFactory(Handle handle, AspireClient client) { - super(handle, client); + public ProjectResource withEndpoint() { + return withEndpoint(null); } - /** Creates a logger for a category */ - public ILogger createLogger(String categoryName) { + /** Adds a network endpoint */ + private ProjectResource withEndpointImpl(Double port, Double targetPort, String scheme, String name, String env, Boolean isProxied, Boolean isExternal, ProtocolType protocol) { Map reqArgs = new HashMap<>(); - reqArgs.put("loggerFactory", AspireClient.serializeValue(getHandle())); - reqArgs.put("categoryName", AspireClient.serializeValue(categoryName)); - return (ILogger) getClient().invokeCapability("Aspire.Hosting/createLogger", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + if (port != null) { + reqArgs.put("port", AspireClient.serializeValue(port)); + } + if (targetPort != null) { + reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); + } + if (scheme != null) { + reqArgs.put("scheme", AspireClient.serializeValue(scheme)); + } + if (name != null) { + reqArgs.put("name", AspireClient.serializeValue(name)); + } + if (env != null) { + reqArgs.put("env", AspireClient.serializeValue(env)); + } + if (isProxied != null) { + reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); + } + if (isExternal != null) { + reqArgs.put("isExternal", AspireClient.serializeValue(isExternal)); + } + if (protocol != null) { + reqArgs.put("protocol", AspireClient.serializeValue(protocol)); + } + getClient().invokeCapability("Aspire.Hosting/withEndpoint", reqArgs); + return this; } -} + /** Adds an HTTP endpoint */ + public ProjectResource withHttpEndpoint(WithHttpEndpointOptions options) { + var port = options == null ? null : options.getPort(); + var targetPort = options == null ? null : options.getTargetPort(); + var name = options == null ? null : options.getName(); + var env = options == null ? null : options.getEnv(); + var isProxied = options == null ? null : options.isProxied(); + return withHttpEndpointImpl(port, targetPort, name, env, isProxied); + } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingStep. */ -class IReportingStep extends HandleWrapperBase { - IReportingStep(Handle handle, AspireClient client) { - super(handle, client); + public ProjectResource withHttpEndpoint() { + return withHttpEndpoint(null); } - /** Creates a reporting task with plain-text status text */ - public IReportingTask createTask(String statusText, CancellationToken cancellationToken) { + /** Adds an HTTP endpoint */ + private ProjectResource withHttpEndpointImpl(Double port, Double targetPort, String name, String env, Boolean isProxied) { Map reqArgs = new HashMap<>(); - reqArgs.put("reportingStep", AspireClient.serializeValue(getHandle())); - reqArgs.put("statusText", AspireClient.serializeValue(statusText)); - if (cancellationToken != null) { - reqArgs.put("cancellationToken", getClient().registerCancellation(cancellationToken)); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + if (port != null) { + reqArgs.put("port", AspireClient.serializeValue(port)); } - return (IReportingTask) getClient().invokeCapability("Aspire.Hosting/createTask", reqArgs); + if (targetPort != null) { + reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); + } + if (name != null) { + reqArgs.put("name", AspireClient.serializeValue(name)); + } + if (env != null) { + reqArgs.put("env", AspireClient.serializeValue(env)); + } + if (isProxied != null) { + reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); + } + getClient().invokeCapability("Aspire.Hosting/withHttpEndpoint", reqArgs); + return this; } - /** Creates a reporting task with Markdown-formatted status text */ - public IReportingTask createMarkdownTask(String markdownString, CancellationToken cancellationToken) { + /** Adds an HTTPS endpoint */ + public ProjectResource withHttpsEndpoint(WithHttpsEndpointOptions options) { + var port = options == null ? null : options.getPort(); + var targetPort = options == null ? null : options.getTargetPort(); + var name = options == null ? null : options.getName(); + var env = options == null ? null : options.getEnv(); + var isProxied = options == null ? null : options.isProxied(); + return withHttpsEndpointImpl(port, targetPort, name, env, isProxied); + } + + public ProjectResource withHttpsEndpoint() { + return withHttpsEndpoint(null); + } + + /** Adds an HTTPS endpoint */ + private ProjectResource withHttpsEndpointImpl(Double port, Double targetPort, String name, String env, Boolean isProxied) { Map reqArgs = new HashMap<>(); - reqArgs.put("reportingStep", AspireClient.serializeValue(getHandle())); - reqArgs.put("markdownString", AspireClient.serializeValue(markdownString)); - if (cancellationToken != null) { - reqArgs.put("cancellationToken", getClient().registerCancellation(cancellationToken)); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + if (port != null) { + reqArgs.put("port", AspireClient.serializeValue(port)); } - return (IReportingTask) getClient().invokeCapability("Aspire.Hosting/createMarkdownTask", reqArgs); + if (targetPort != null) { + reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); + } + if (name != null) { + reqArgs.put("name", AspireClient.serializeValue(name)); + } + if (env != null) { + reqArgs.put("env", AspireClient.serializeValue(env)); + } + if (isProxied != null) { + reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); + } + getClient().invokeCapability("Aspire.Hosting/withHttpsEndpoint", reqArgs); + return this; } - /** Logs a plain-text message for the reporting step */ - public void logStep(String level, String message) { + /** Makes HTTP endpoints externally accessible */ + public ProjectResource withExternalHttpEndpoints() { Map reqArgs = new HashMap<>(); - reqArgs.put("reportingStep", AspireClient.serializeValue(getHandle())); - reqArgs.put("level", AspireClient.serializeValue(level)); - reqArgs.put("message", AspireClient.serializeValue(message)); - getClient().invokeCapability("Aspire.Hosting/logStep", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + getClient().invokeCapability("Aspire.Hosting/withExternalHttpEndpoints", reqArgs); + return this; } - /** Logs a Markdown-formatted message for the reporting step */ - public void logStepMarkdown(String level, String markdownString) { + /** Gets an endpoint reference */ + public EndpointReference getEndpoint(String name) { Map reqArgs = new HashMap<>(); - reqArgs.put("reportingStep", AspireClient.serializeValue(getHandle())); - reqArgs.put("level", AspireClient.serializeValue(level)); - reqArgs.put("markdownString", AspireClient.serializeValue(markdownString)); - getClient().invokeCapability("Aspire.Hosting/logStepMarkdown", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("name", AspireClient.serializeValue(name)); + return (EndpointReference) getClient().invokeCapability("Aspire.Hosting/getEndpoint", reqArgs); } - /** Completes the reporting step with plain-text completion text */ - public void completeStep(String completionText, String completionState, CancellationToken cancellationToken) { + /** Configures resource for HTTP/2 */ + public ProjectResource asHttp2Service() { Map reqArgs = new HashMap<>(); - reqArgs.put("reportingStep", AspireClient.serializeValue(getHandle())); - reqArgs.put("completionText", AspireClient.serializeValue(completionText)); - if (completionState != null) { - reqArgs.put("completionState", AspireClient.serializeValue(completionState)); - } - if (cancellationToken != null) { - reqArgs.put("cancellationToken", getClient().registerCancellation(cancellationToken)); - } - getClient().invokeCapability("Aspire.Hosting/completeStep", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + getClient().invokeCapability("Aspire.Hosting/asHttp2Service", reqArgs); + return this; } - /** Completes the reporting step with Markdown-formatted completion text */ - public void completeStepMarkdown(String markdownString, String completionState, CancellationToken cancellationToken) { + /** Customizes displayed URLs via callback */ + public ProjectResource withUrlsCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); - reqArgs.put("reportingStep", AspireClient.serializeValue(getHandle())); - reqArgs.put("markdownString", AspireClient.serializeValue(markdownString)); - if (completionState != null) { - reqArgs.put("completionState", AspireClient.serializeValue(completionState)); - } - if (cancellationToken != null) { - reqArgs.put("cancellationToken", getClient().registerCancellation(cancellationToken)); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var obj = (ResourceUrlsCallbackContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - getClient().invokeCapability("Aspire.Hosting/completeStepMarkdown", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrlsCallback", reqArgs); + return this; } -} + /** Customizes displayed URLs via async callback */ + public ProjectResource withUrlsCallbackAsync(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceUrlsCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withUrlsCallbackAsync", reqArgs); + return this; + } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingTask. */ -class IReportingTask extends HandleWrapperBase { - IReportingTask(Handle handle, AspireClient client) { - super(handle, client); + public ProjectResource withUrl(String url) { + return withUrl(url, null); } - /** Updates the reporting task with plain-text status text */ - public void updateTask(String statusText, CancellationToken cancellationToken) { + /** Adds or modifies displayed URLs */ + public ProjectResource withUrl(String url, String displayText) { Map reqArgs = new HashMap<>(); - reqArgs.put("reportingTask", AspireClient.serializeValue(getHandle())); - reqArgs.put("statusText", AspireClient.serializeValue(statusText)); - if (cancellationToken != null) { - reqArgs.put("cancellationToken", getClient().registerCancellation(cancellationToken)); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("url", AspireClient.serializeValue(url)); + if (displayText != null) { + reqArgs.put("displayText", AspireClient.serializeValue(displayText)); } - getClient().invokeCapability("Aspire.Hosting/updateTask", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrl", reqArgs); + return this; } - /** Updates the reporting task with Markdown-formatted status text */ - public void updateTaskMarkdown(String markdownString, CancellationToken cancellationToken) { - Map reqArgs = new HashMap<>(); - reqArgs.put("reportingTask", AspireClient.serializeValue(getHandle())); - reqArgs.put("markdownString", AspireClient.serializeValue(markdownString)); - if (cancellationToken != null) { - reqArgs.put("cancellationToken", getClient().registerCancellation(cancellationToken)); - } - getClient().invokeCapability("Aspire.Hosting/updateTaskMarkdown", reqArgs); + public ProjectResource withUrlExpression(ReferenceExpression url) { + return withUrlExpression(url, null); } - /** Completes the reporting task with plain-text completion text */ - public void completeTask(String completionMessage, String completionState, CancellationToken cancellationToken) { + /** Adds a URL using a reference expression */ + public ProjectResource withUrlExpression(ReferenceExpression url, String displayText) { Map reqArgs = new HashMap<>(); - reqArgs.put("reportingTask", AspireClient.serializeValue(getHandle())); - if (completionMessage != null) { - reqArgs.put("completionMessage", AspireClient.serializeValue(completionMessage)); - } - if (completionState != null) { - reqArgs.put("completionState", AspireClient.serializeValue(completionState)); - } - if (cancellationToken != null) { - reqArgs.put("cancellationToken", getClient().registerCancellation(cancellationToken)); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("url", AspireClient.serializeValue(url)); + if (displayText != null) { + reqArgs.put("displayText", AspireClient.serializeValue(displayText)); } - getClient().invokeCapability("Aspire.Hosting/completeTask", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrlExpression", reqArgs); + return this; } - /** Completes the reporting task with Markdown-formatted completion text */ - public void completeTaskMarkdown(String markdownString, String completionState, CancellationToken cancellationToken) { + /** Customizes the URL for a specific endpoint via callback */ + public ProjectResource withUrlForEndpoint(String endpointName, AspireAction1 callback) { Map reqArgs = new HashMap<>(); - reqArgs.put("reportingTask", AspireClient.serializeValue(getHandle())); - reqArgs.put("markdownString", AspireClient.serializeValue(markdownString)); - if (completionState != null) { - reqArgs.put("completionState", AspireClient.serializeValue(completionState)); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + var callbackId = getClient().registerCallback(args -> { + var obj = (ResourceUrlAnnotation) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - if (cancellationToken != null) { - reqArgs.put("cancellationToken", getClient().registerCancellation(cancellationToken)); + getClient().invokeCapability("Aspire.Hosting/withUrlForEndpoint", reqArgs); + return this; + } + + /** Adds a URL for a specific endpoint via factory callback */ + public ProjectResource withUrlForEndpointFactory(String endpointName, AspireFunc1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + var callbackId = getClient().registerCallback(args -> { + var arg = (EndpointReference) args[0]; + return AspireClient.awaitValue(callback.invoke(arg)); + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - getClient().invokeCapability("Aspire.Hosting/completeTaskMarkdown", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrlForEndpointFactory", reqArgs); + return this; } -} + /** Configures the resource to copy container files from the specified source during publishing */ + public ProjectResource publishWithContainerFiles(IResourceWithContainerFiles source, String destinationPath) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("source", AspireClient.serializeValue(source)); + reqArgs.put("destinationPath", AspireClient.serializeValue(destinationPath)); + getClient().invokeCapability("Aspire.Hosting/publishWithContainerFiles", reqArgs); + return this; + } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource. */ -class IResource extends ResourceBuilderBase { - IResource(Handle handle, AspireClient client) { - super(handle, client); + public ProjectResource publishWithContainerFiles(ResourceBuilderBase source, String destinationPath) { + return publishWithContainerFiles(new IResourceWithContainerFiles(source.getHandle(), source.getClient()), destinationPath); } -} + /** Excludes the resource from the deployment manifest */ + public ProjectResource excludeFromManifest() { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + getClient().invokeCapability("Aspire.Hosting/excludeFromManifest", reqArgs); + return this; + } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs. */ -class IResourceWithArgs extends ResourceBuilderBase { - IResourceWithArgs(Handle handle, AspireClient client) { - super(handle, client); + /** Waits for another resource to be ready */ + public ProjectResource waitFor(IResource dependency) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + getClient().invokeCapability("Aspire.Hosting/waitFor", reqArgs); + return this; } -} + public ProjectResource waitFor(ResourceBuilderBase dependency) { + return waitFor(new IResource(dependency.getHandle(), dependency.getClient())); + } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString. */ -class IResourceWithConnectionString extends ResourceBuilderBase { - IResourceWithConnectionString(Handle handle, AspireClient client) { - super(handle, client); + /** Waits for another resource with specific behavior */ + public ProjectResource waitForWithBehavior(IResource dependency, WaitBehavior waitBehavior) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + reqArgs.put("waitBehavior", AspireClient.serializeValue(waitBehavior)); + getClient().invokeCapability("Aspire.Hosting/waitForWithBehavior", reqArgs); + return this; } -} + public ProjectResource waitForWithBehavior(ResourceBuilderBase dependency, WaitBehavior waitBehavior) { + return waitForWithBehavior(new IResource(dependency.getHandle(), dependency.getClient()), waitBehavior); + } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles. */ -class IResourceWithContainerFiles extends ResourceBuilderBase { - IResourceWithContainerFiles(Handle handle, AspireClient client) { - super(handle, client); + /** Waits for another resource to start */ + public ProjectResource waitForStart(IResource dependency) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + getClient().invokeCapability("Aspire.Hosting/waitForStart", reqArgs); + return this; } - /** Sets the source directory for container files */ - public IResourceWithContainerFiles withContainerFilesSource(String sourcePath) { + public ProjectResource waitForStart(ResourceBuilderBase dependency) { + return waitForStart(new IResource(dependency.getHandle(), dependency.getClient())); + } + + /** Waits for another resource to start with specific behavior */ + public ProjectResource waitForStartWithBehavior(IResource dependency, WaitBehavior waitBehavior) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("sourcePath", AspireClient.serializeValue(sourcePath)); - return (IResourceWithContainerFiles) getClient().invokeCapability("Aspire.Hosting/withContainerFilesSource", reqArgs); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + reqArgs.put("waitBehavior", AspireClient.serializeValue(waitBehavior)); + getClient().invokeCapability("Aspire.Hosting/waitForStartWithBehavior", reqArgs); + return this; } - /** Clears all container file sources */ - public IResourceWithContainerFiles clearContainerFilesSources() { + public ProjectResource waitForStartWithBehavior(ResourceBuilderBase dependency, WaitBehavior waitBehavior) { + return waitForStartWithBehavior(new IResource(dependency.getHandle(), dependency.getClient()), waitBehavior); + } + + /** Prevents resource from starting automatically */ + public ProjectResource withExplicitStart() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResourceWithContainerFiles) getClient().invokeCapability("Aspire.Hosting/clearContainerFilesSources", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withExplicitStart", reqArgs); + return this; } -} + public ProjectResource waitForCompletion(IResource dependency) { + return waitForCompletion(dependency, null); + } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints. */ -class IResourceWithEndpoints extends ResourceBuilderBase { - IResourceWithEndpoints(Handle handle, AspireClient client) { - super(handle, client); + public ProjectResource waitForCompletion(ResourceBuilderBase dependency) { + return waitForCompletion(new IResource(dependency.getHandle(), dependency.getClient())); } -} + /** Waits for resource completion */ + public ProjectResource waitForCompletion(IResource dependency, Double exitCode) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + if (exitCode != null) { + reqArgs.put("exitCode", AspireClient.serializeValue(exitCode)); + } + getClient().invokeCapability("Aspire.Hosting/waitForCompletion", reqArgs); + return this; + } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment. */ -class IResourceWithEnvironment extends ResourceBuilderBase { - IResourceWithEnvironment(Handle handle, AspireClient client) { - super(handle, client); + public ProjectResource waitForCompletion(ResourceBuilderBase dependency, Double exitCode) { + return waitForCompletion(new IResource(dependency.getHandle(), dependency.getClient()), exitCode); } -} + /** Adds a health check by key */ + public ProjectResource withHealthCheck(String key) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("key", AspireClient.serializeValue(key)); + getClient().invokeCapability("Aspire.Hosting/withHealthCheck", reqArgs); + return this; + } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithParent. */ -class IResourceWithParent extends ResourceBuilderBase { - IResourceWithParent(Handle handle, AspireClient client) { - super(handle, client); + /** Adds an HTTP health check */ + public ProjectResource withHttpHealthCheck(WithHttpHealthCheckOptions options) { + var path = options == null ? null : options.getPath(); + var statusCode = options == null ? null : options.getStatusCode(); + var endpointName = options == null ? null : options.getEndpointName(); + return withHttpHealthCheckImpl(path, statusCode, endpointName); } -} + public ProjectResource withHttpHealthCheck() { + return withHttpHealthCheck(null); + } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport. */ -class IResourceWithWaitSupport extends ResourceBuilderBase { - IResourceWithWaitSupport(Handle handle, AspireClient client) { - super(handle, client); + /** Adds an HTTP health check */ + private ProjectResource withHttpHealthCheckImpl(String path, Double statusCode, String endpointName) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + if (path != null) { + reqArgs.put("path", AspireClient.serializeValue(path)); + } + if (statusCode != null) { + reqArgs.put("statusCode", AspireClient.serializeValue(statusCode)); + } + if (endpointName != null) { + reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + } + getClient().invokeCapability("Aspire.Hosting/withHttpHealthCheck", reqArgs); + return this; } -} + public ProjectResource withCommand(String name, String displayName, AspireFunc1 executeCommand) { + return withCommand(name, displayName, executeCommand, null); + } -/** Wrapper for System.ComponentModel/System.IServiceProvider. */ -class IServiceProvider extends HandleWrapperBase { - IServiceProvider(Handle handle, AspireClient client) { - super(handle, client); + /** Adds a resource command */ + public ProjectResource withCommand(String name, String displayName, AspireFunc1 executeCommand, CommandOptions commandOptions) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("displayName", AspireClient.serializeValue(displayName)); + var executeCommandId = getClient().registerCallback(args -> { + var arg = (ExecuteCommandContext) args[0]; + return AspireClient.awaitValue(executeCommand.invoke(arg)); + }); + if (executeCommandId != null) { + reqArgs.put("executeCommand", executeCommandId); + } + if (commandOptions != null) { + reqArgs.put("commandOptions", AspireClient.serializeValue(commandOptions)); + } + getClient().invokeCapability("Aspire.Hosting/withCommand", reqArgs); + return this; } - /** Gets the distributed application eventing service from the service provider */ - public IDistributedApplicationEventing getEventing() { + /** Configures developer certificate trust */ + public ProjectResource withDeveloperCertificateTrust(boolean trust) { Map reqArgs = new HashMap<>(); - reqArgs.put("serviceProvider", AspireClient.serializeValue(getHandle())); - return (IDistributedApplicationEventing) getClient().invokeCapability("Aspire.Hosting/getEventing", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("trust", AspireClient.serializeValue(trust)); + getClient().invokeCapability("Aspire.Hosting/withDeveloperCertificateTrust", reqArgs); + return this; } - /** Gets the logger factory from the service provider */ - public ILoggerFactory getLoggerFactory() { + /** Sets the certificate trust scope */ + public ProjectResource withCertificateTrustScope(CertificateTrustScope scope) { Map reqArgs = new HashMap<>(); - reqArgs.put("serviceProvider", AspireClient.serializeValue(getHandle())); - return (ILoggerFactory) getClient().invokeCapability("Aspire.Hosting/getLoggerFactory", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("scope", AspireClient.serializeValue(scope)); + getClient().invokeCapability("Aspire.Hosting/withCertificateTrustScope", reqArgs); + return this; } - /** Gets the resource logger service from the service provider */ - public ResourceLoggerService getResourceLoggerService() { + public ProjectResource withHttpsDeveloperCertificate() { + return withHttpsDeveloperCertificate(null); + } + + /** Configures HTTPS with a developer certificate */ + public ProjectResource withHttpsDeveloperCertificate(ParameterResource password) { Map reqArgs = new HashMap<>(); - reqArgs.put("serviceProvider", AspireClient.serializeValue(getHandle())); - return (ResourceLoggerService) getClient().invokeCapability("Aspire.Hosting/getResourceLoggerService", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + if (password != null) { + reqArgs.put("password", AspireClient.serializeValue(password)); + } + getClient().invokeCapability("Aspire.Hosting/withHttpsDeveloperCertificate", reqArgs); + return this; } - /** Gets the distributed application model from the service provider */ - public DistributedApplicationModel getDistributedApplicationModel() { + /** Removes HTTPS certificate configuration */ + public ProjectResource withoutHttpsCertificate() { Map reqArgs = new HashMap<>(); - reqArgs.put("serviceProvider", AspireClient.serializeValue(getHandle())); - return (DistributedApplicationModel) getClient().invokeCapability("Aspire.Hosting/getDistributedApplicationModel", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + getClient().invokeCapability("Aspire.Hosting/withoutHttpsCertificate", reqArgs); + return this; } - /** Gets the resource notification service from the service provider */ - public ResourceNotificationService getResourceNotificationService() { + /** Sets the parent relationship */ + public ProjectResource withParentRelationship(IResource parent) { Map reqArgs = new HashMap<>(); - reqArgs.put("serviceProvider", AspireClient.serializeValue(getHandle())); - return (ResourceNotificationService) getClient().invokeCapability("Aspire.Hosting/getResourceNotificationService", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("parent", AspireClient.serializeValue(parent)); + getClient().invokeCapability("Aspire.Hosting/withParentRelationship", reqArgs); + return this; } - /** Gets the user secrets manager from the service provider */ - public IUserSecretsManager getUserSecretsManager() { + public ProjectResource withParentRelationship(ResourceBuilderBase parent) { + return withParentRelationship(new IResource(parent.getHandle(), parent.getClient())); + } + + /** Sets a child relationship */ + public ProjectResource withChildRelationship(IResource child) { Map reqArgs = new HashMap<>(); - reqArgs.put("serviceProvider", AspireClient.serializeValue(getHandle())); - return (IUserSecretsManager) getClient().invokeCapability("Aspire.Hosting/getUserSecretsManager", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("child", AspireClient.serializeValue(child)); + getClient().invokeCapability("Aspire.Hosting/withChildRelationship", reqArgs); + return this; } -} + public ProjectResource withChildRelationship(ResourceBuilderBase child) { + return withChildRelationship(new IResource(child.getHandle(), child.getClient())); + } -/** Wrapper for Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.ITestVaultResource. */ -class ITestVaultResource extends ResourceBuilderBase { - ITestVaultResource(Handle handle, AspireClient client) { - super(handle, client); + public ProjectResource withIconName(String iconName) { + return withIconName(iconName, null); } -} + /** Sets the icon for the resource */ + public ProjectResource withIconName(String iconName, IconVariant iconVariant) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("iconName", AspireClient.serializeValue(iconName)); + if (iconVariant != null) { + reqArgs.put("iconVariant", AspireClient.serializeValue(iconVariant)); + } + getClient().invokeCapability("Aspire.Hosting/withIconName", reqArgs); + return this; + } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.IUserSecretsManager. */ -class IUserSecretsManager extends HandleWrapperBase { - IUserSecretsManager(Handle handle, AspireClient client) { - super(handle, client); + /** Adds an HTTP health probe to the resource */ + public ProjectResource withHttpProbe(ProbeType probeType, WithHttpProbeOptions options) { + var path = options == null ? null : options.getPath(); + var initialDelaySeconds = options == null ? null : options.getInitialDelaySeconds(); + var periodSeconds = options == null ? null : options.getPeriodSeconds(); + var timeoutSeconds = options == null ? null : options.getTimeoutSeconds(); + var failureThreshold = options == null ? null : options.getFailureThreshold(); + var successThreshold = options == null ? null : options.getSuccessThreshold(); + var endpointName = options == null ? null : options.getEndpointName(); + return withHttpProbeImpl(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName); } - /** Gets the IsAvailable property */ - public boolean isAvailable() { + public ProjectResource withHttpProbe(ProbeType probeType) { + return withHttpProbe(probeType, null); + } + + /** Adds an HTTP health probe to the resource */ + private ProjectResource withHttpProbeImpl(ProbeType probeType, String path, Double initialDelaySeconds, Double periodSeconds, Double timeoutSeconds, Double failureThreshold, Double successThreshold, String endpointName) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (boolean) getClient().invokeCapability("Aspire.Hosting/IUserSecretsManager.isAvailable", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("probeType", AspireClient.serializeValue(probeType)); + if (path != null) { + reqArgs.put("path", AspireClient.serializeValue(path)); + } + if (initialDelaySeconds != null) { + reqArgs.put("initialDelaySeconds", AspireClient.serializeValue(initialDelaySeconds)); + } + if (periodSeconds != null) { + reqArgs.put("periodSeconds", AspireClient.serializeValue(periodSeconds)); + } + if (timeoutSeconds != null) { + reqArgs.put("timeoutSeconds", AspireClient.serializeValue(timeoutSeconds)); + } + if (failureThreshold != null) { + reqArgs.put("failureThreshold", AspireClient.serializeValue(failureThreshold)); + } + if (successThreshold != null) { + reqArgs.put("successThreshold", AspireClient.serializeValue(successThreshold)); + } + if (endpointName != null) { + reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + } + getClient().invokeCapability("Aspire.Hosting/withHttpProbe", reqArgs); + return this; } - /** Gets the FilePath property */ - public String filePath() { + /** Excludes the resource from MCP server exposure */ + public ProjectResource excludeFromMcp() { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (String) getClient().invokeCapability("Aspire.Hosting/IUserSecretsManager.filePath", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + getClient().invokeCapability("Aspire.Hosting/excludeFromMcp", reqArgs); + return this; } - /** Attempts to set a user secret value */ - public boolean trySetSecret(String name, String value) { + /** Sets the remote image name for publishing */ + public ProjectResource withRemoteImageName(String remoteImageName) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (boolean) getClient().invokeCapability("Aspire.Hosting/IUserSecretsManager.trySetSecret", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("remoteImageName", AspireClient.serializeValue(remoteImageName)); + getClient().invokeCapability("Aspire.Hosting/withRemoteImageName", reqArgs); + return this; } - /** Saves state to user secrets from a JSON string */ - public void saveStateJson(String json, CancellationToken cancellationToken) { + /** Sets the remote image tag for publishing */ + public ProjectResource withRemoteImageTag(String remoteImageTag) { Map reqArgs = new HashMap<>(); - reqArgs.put("userSecretsManager", AspireClient.serializeValue(getHandle())); - reqArgs.put("json", AspireClient.serializeValue(json)); - if (cancellationToken != null) { - reqArgs.put("cancellationToken", getClient().registerCancellation(cancellationToken)); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("remoteImageTag", AspireClient.serializeValue(remoteImageTag)); + getClient().invokeCapability("Aspire.Hosting/withRemoteImageTag", reqArgs); + return this; + } + + /** Adds a pipeline step to the resource */ + public ProjectResource withPipelineStepFactory(String stepName, AspireAction1 callback, WithPipelineStepFactoryOptions options) { + var dependsOn = options == null ? null : options.getDependsOn(); + var requiredBy = options == null ? null : options.getRequiredBy(); + var tags = options == null ? null : options.getTags(); + var description = options == null ? null : options.getDescription(); + return withPipelineStepFactoryImpl(stepName, callback, dependsOn, requiredBy, tags, description); + } + + public ProjectResource withPipelineStepFactory(String stepName, AspireAction1 callback) { + return withPipelineStepFactory(stepName, callback, null); + } + + /** Adds a pipeline step to the resource */ + private ProjectResource withPipelineStepFactoryImpl(String stepName, AspireAction1 callback, String[] dependsOn, String[] requiredBy, String[] tags, String description) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("stepName", AspireClient.serializeValue(stepName)); + var callbackId = getClient().registerCallback(args -> { + var arg = (PipelineStepContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + if (dependsOn != null) { + reqArgs.put("dependsOn", AspireClient.serializeValue(dependsOn)); + } + if (requiredBy != null) { + reqArgs.put("requiredBy", AspireClient.serializeValue(requiredBy)); + } + if (tags != null) { + reqArgs.put("tags", AspireClient.serializeValue(tags)); + } + if (description != null) { + reqArgs.put("description", AspireClient.serializeValue(description)); } - getClient().invokeCapability("Aspire.Hosting/saveStateJson", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withPipelineStepFactory", reqArgs); + return this; } - /** Gets a secret value if it exists, or sets it to the provided value if it does not */ - public void getOrSetSecret(IResource resourceBuilder, String name, String value) { + /** Configures pipeline step dependencies via an async callback */ + public ProjectResource withPipelineConfigurationAsync(AspireAction1 callback) { Map reqArgs = new HashMap<>(); - reqArgs.put("userSecretsManager", AspireClient.serializeValue(getHandle())); - reqArgs.put("resourceBuilder", AspireClient.serializeValue(resourceBuilder)); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("value", AspireClient.serializeValue(value)); - getClient().invokeCapability("Aspire.Hosting/getOrSetSecret", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (PipelineConfigurationContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withPipelineConfigurationAsync", reqArgs); + return this; } -} - -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent. */ -class InitializeResourceEvent extends HandleWrapperBase { - InitializeResourceEvent(Handle handle, AspireClient client) { - super(handle, client); + /** Configures pipeline step dependencies via a callback */ + public ProjectResource withPipelineConfiguration(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var obj = (PipelineConfigurationContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withPipelineConfiguration", reqArgs); + return this; } - /** Gets the Resource property */ - public IResource resource() { + /** Gets the resource name */ + public String getResourceName() { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/InitializeResourceEvent.resource", reqArgs); + reqArgs.put("resource", AspireClient.serializeValue(getHandle())); + return (String) getClient().invokeCapability("Aspire.Hosting/getResourceName", reqArgs); } - /** Gets the Eventing property */ - public IDistributedApplicationEventing eventing() { + /** Subscribes to the BeforeResourceStarted event */ + public ProjectResource onBeforeResourceStarted(AspireAction1 callback) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (IDistributedApplicationEventing) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/InitializeResourceEvent.eventing", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (BeforeResourceStartedEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onBeforeResourceStarted", reqArgs); + return this; } - /** Gets the Logger property */ - public ILogger logger() { + /** Subscribes to the ResourceStopped event */ + public ProjectResource onResourceStopped(AspireAction1 callback) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (ILogger) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/InitializeResourceEvent.logger", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceStoppedEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onResourceStopped", reqArgs); + return this; } - /** Gets the Notifications property */ - public ResourceNotificationService notifications() { + /** Subscribes to the InitializeResource event */ + public ProjectResource onInitializeResource(AspireAction1 callback) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (ResourceNotificationService) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/InitializeResourceEvent.notifications", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (InitializeResourceEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onInitializeResource", reqArgs); + return this; } - /** Gets the Services property */ - public IServiceProvider services() { + /** Subscribes to the ResourceEndpointsAllocated event */ + public ProjectResource onResourceEndpointsAllocated(AspireAction1 callback) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (IServiceProvider) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/InitializeResourceEvent.services", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceEndpointsAllocatedEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onResourceEndpointsAllocated", reqArgs); + return this; } -} + /** Subscribes to the ResourceReady event */ + public ProjectResource onResourceReady(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceReadyEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onResourceReady", reqArgs); + return this; + } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource. */ -class ParameterResource extends ResourceBuilderBase { - ParameterResource(Handle handle, AspireClient client) { - super(handle, client); + /** Adds an optional string parameter */ + public ProjectResource withOptionalString(WithOptionalStringOptions options) { + var value = options == null ? null : options.getValue(); + var enabled = options == null ? null : options.getEnabled(); + return withOptionalStringImpl(value, enabled); } - /** Configures a resource to use a container registry */ - public IResource withContainerRegistry(IResource registry) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("registry", AspireClient.serializeValue(registry)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withContainerRegistry", reqArgs); + public ProjectResource withOptionalString() { + return withOptionalString(null); } - /** Sets the base image for a Dockerfile build */ - public IResource withDockerfileBaseImage(String buildImage, String runtimeImage) { + /** Adds an optional string parameter */ + private ProjectResource withOptionalStringImpl(String value, Boolean enabled) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (buildImage != null) { - reqArgs.put("buildImage", AspireClient.serializeValue(buildImage)); + if (value != null) { + reqArgs.put("value", AspireClient.serializeValue(value)); } - if (runtimeImage != null) { - reqArgs.put("runtimeImage", AspireClient.serializeValue(runtimeImage)); + if (enabled != null) { + reqArgs.put("enabled", AspireClient.serializeValue(enabled)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withDockerfileBaseImage", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalString", reqArgs); + return this; } - /** Sets a parameter description */ - public ParameterResource withDescription(String description, Boolean enableMarkdown) { + /** Configures the resource with a DTO */ + public ProjectResource withConfig(TestConfigDto config) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("description", AspireClient.serializeValue(description)); - if (enableMarkdown != null) { - reqArgs.put("enableMarkdown", AspireClient.serializeValue(enableMarkdown)); - } - return (ParameterResource) getClient().invokeCapability("Aspire.Hosting/withDescription", reqArgs); + reqArgs.put("config", AspireClient.serializeValue(config)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConfig", reqArgs); + return this; } - /** Adds a required command dependency */ - public IResource withRequiredCommand(String command, String helpLink) { + /** Configures environment with callback (test version) */ + public ProjectResource testWithEnvironmentCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("command", AspireClient.serializeValue(command)); - if (helpLink != null) { - reqArgs.put("helpLink", AspireClient.serializeValue(helpLink)); + var callbackId = getClient().registerCallback(args -> { + var arg = (TestEnvironmentContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withRequiredCommand", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWithEnvironmentCallback", reqArgs); + return this; } - /** Customizes displayed URLs via callback */ - public IResource withUrlsCallback(Function callback) { + /** Sets the created timestamp */ + public ProjectResource withCreatedAt(String createdAt) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlsCallback", reqArgs); + reqArgs.put("createdAt", AspireClient.serializeValue(createdAt)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCreatedAt", reqArgs); + return this; } - /** Customizes displayed URLs via async callback */ - public IResource withUrlsCallbackAsync(Function callback) { + /** Sets the modified timestamp */ + public ProjectResource withModifiedAt(String modifiedAt) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlsCallbackAsync", reqArgs); + reqArgs.put("modifiedAt", AspireClient.serializeValue(modifiedAt)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withModifiedAt", reqArgs); + return this; } - /** Adds or modifies displayed URLs */ - public IResource withUrl(String url, String displayText) { + /** Sets the correlation ID */ + public ProjectResource withCorrelationId(String correlationId) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("url", AspireClient.serializeValue(url)); - if (displayText != null) { - reqArgs.put("displayText", AspireClient.serializeValue(displayText)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrl", reqArgs); + reqArgs.put("correlationId", AspireClient.serializeValue(correlationId)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCorrelationId", reqArgs); + return this; } - /** Adds a URL using a reference expression */ - public IResource withUrlExpression(ReferenceExpression url, String displayText) { + public ProjectResource withOptionalCallback() { + return withOptionalCallback(null); + } + + /** Configures with optional callback */ + public ProjectResource withOptionalCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("url", AspireClient.serializeValue(url)); - if (displayText != null) { - reqArgs.put("displayText", AspireClient.serializeValue(displayText)); + var callbackId = callback == null ? null : getClient().registerCallback(args -> { + var arg = (TestCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlExpression", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalCallback", reqArgs); + return this; } - /** Customizes the URL for a specific endpoint via callback */ - public IResource withUrlForEndpoint(String endpointName, Function callback) { + /** Sets the resource status */ + public ProjectResource withStatus(TestResourceStatus status) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlForEndpoint", reqArgs); + reqArgs.put("status", AspireClient.serializeValue(status)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withStatus", reqArgs); + return this; } - /** Excludes the resource from the deployment manifest */ - public IResource excludeFromManifest() { + /** Configures with nested DTO */ + public ProjectResource withNestedConfig(TestNestedDto config) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/excludeFromManifest", reqArgs); + reqArgs.put("config", AspireClient.serializeValue(config)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withNestedConfig", reqArgs); + return this; } - /** Prevents resource from starting automatically */ - public IResource withExplicitStart() { + /** Adds validation callback */ + public ProjectResource withValidator(AspireFunc1 validator) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withExplicitStart", reqArgs); + var validatorId = getClient().registerCallback(args -> { + var arg = (TestResourceContext) args[0]; + return AspireClient.awaitValue(validator.invoke(arg)); + }); + if (validatorId != null) { + reqArgs.put("validator", validatorId); + } + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withValidator", reqArgs); + return this; } - /** Adds a health check by key */ - public IResource withHealthCheck(String key) { + /** Waits for another resource (test version) */ + public ProjectResource testWaitFor(IResource dependency) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("key", AspireClient.serializeValue(key)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withHealthCheck", reqArgs); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWaitFor", reqArgs); + return this; } - /** Adds a resource command */ - public IResource withCommand(String name, String displayName, Function executeCommand, CommandOptions commandOptions) { + public ProjectResource testWaitFor(ResourceBuilderBase dependency) { + return testWaitFor(new IResource(dependency.getHandle(), dependency.getClient())); + } + + /** Adds a dependency on another resource */ + public ProjectResource withDependency(IResourceWithConnectionString dependency) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("displayName", AspireClient.serializeValue(displayName)); - if (executeCommand != null) { - reqArgs.put("executeCommand", getClient().registerCallback(executeCommand)); - } - if (commandOptions != null) { - reqArgs.put("commandOptions", AspireClient.serializeValue(commandOptions)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withCommand", reqArgs); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDependency", reqArgs); + return this; } - /** Sets the parent relationship */ - public IResource withParentRelationship(IResource parent) { + public ProjectResource withDependency(ResourceBuilderBase dependency) { + return withDependency(new IResourceWithConnectionString(dependency.getHandle(), dependency.getClient())); + } + + /** Sets the endpoints */ + public ProjectResource withEndpoints(String[] endpoints) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("parent", AspireClient.serializeValue(parent)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withParentRelationship", reqArgs); + reqArgs.put("endpoints", AspireClient.serializeValue(endpoints)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEndpoints", reqArgs); + return this; } - /** Sets a child relationship */ - public IResource withChildRelationship(IResource child) { + /** Sets environment variables */ + public ProjectResource withEnvironmentVariables(Map variables) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("child", AspireClient.serializeValue(child)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withChildRelationship", reqArgs); + reqArgs.put("variables", AspireClient.serializeValue(variables)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEnvironmentVariables", reqArgs); + return this; } - /** Sets the icon for the resource */ - public IResource withIconName(String iconName, IconVariant iconVariant) { + /** Performs a cancellable operation */ + public ProjectResource withCancellableOperation(AspireAction1 operation) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("iconName", AspireClient.serializeValue(iconName)); - if (iconVariant != null) { - reqArgs.put("iconVariant", AspireClient.serializeValue(iconVariant)); + var operationId = getClient().registerCallback(args -> { + var arg = CancellationToken.fromValue(args[0]); + operation.invoke(arg); + return null; + }); + if (operationId != null) { + reqArgs.put("operation", operationId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withIconName", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCancellableOperation", reqArgs); + return this; } - /** Excludes the resource from MCP server exposure */ - public IResource excludeFromMcp() { +} + +// ===== ProjectResourceOptions.java ===== +// ProjectResourceOptions.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions. */ +public class ProjectResourceOptions extends HandleWrapperBase { + ProjectResourceOptions(Handle handle, AspireClient client) { + super(handle, client); + } + + /** Gets the LaunchProfileName property */ + public String launchProfileName() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/excludeFromMcp", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (String) getClient().invokeCapability("Aspire.Hosting/ProjectResourceOptions.launchProfileName", reqArgs); } - /** Adds a pipeline step to the resource */ - public IResource withPipelineStepFactory(String stepName, Function callback, String[] dependsOn, String[] requiredBy, String[] tags, String description) { + /** Sets the LaunchProfileName property */ + public ProjectResourceOptions setLaunchProfileName(String value) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("stepName", AspireClient.serializeValue(stepName)); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - if (dependsOn != null) { - reqArgs.put("dependsOn", AspireClient.serializeValue(dependsOn)); - } - if (requiredBy != null) { - reqArgs.put("requiredBy", AspireClient.serializeValue(requiredBy)); - } - if (tags != null) { - reqArgs.put("tags", AspireClient.serializeValue(tags)); - } - if (description != null) { - reqArgs.put("description", AspireClient.serializeValue(description)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withPipelineStepFactory", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + reqArgs.put("value", AspireClient.serializeValue(value)); + return (ProjectResourceOptions) getClient().invokeCapability("Aspire.Hosting/ProjectResourceOptions.setLaunchProfileName", reqArgs); + } + + /** Gets the ExcludeLaunchProfile property */ + public boolean excludeLaunchProfile() { + Map reqArgs = new HashMap<>(); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (boolean) getClient().invokeCapability("Aspire.Hosting/ProjectResourceOptions.excludeLaunchProfile", reqArgs); + } + + /** Sets the ExcludeLaunchProfile property */ + public ProjectResourceOptions setExcludeLaunchProfile(boolean value) { + Map reqArgs = new HashMap<>(); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + reqArgs.put("value", AspireClient.serializeValue(value)); + return (ProjectResourceOptions) getClient().invokeCapability("Aspire.Hosting/ProjectResourceOptions.setExcludeLaunchProfile", reqArgs); + } + + /** Gets the ExcludeKestrelEndpoints property */ + public boolean excludeKestrelEndpoints() { + Map reqArgs = new HashMap<>(); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (boolean) getClient().invokeCapability("Aspire.Hosting/ProjectResourceOptions.excludeKestrelEndpoints", reqArgs); + } + + /** Sets the ExcludeKestrelEndpoints property */ + public ProjectResourceOptions setExcludeKestrelEndpoints(boolean value) { + Map reqArgs = new HashMap<>(); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + reqArgs.put("value", AspireClient.serializeValue(value)); + return (ProjectResourceOptions) getClient().invokeCapability("Aspire.Hosting/ProjectResourceOptions.setExcludeKestrelEndpoints", reqArgs); } - /** Configures pipeline step dependencies via an async callback */ - public IResource withPipelineConfigurationAsync(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withPipelineConfigurationAsync", reqArgs); - } +} + +// ===== ProtocolType.java ===== +// ProtocolType.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** ProtocolType enum. */ +public enum ProtocolType implements WireValueEnum { + IP("IP"), + IPV6_HOP_BY_HOP_OPTIONS("IPv6HopByHopOptions"), + UNSPECIFIED("Unspecified"), + ICMP("Icmp"), + IGMP("Igmp"), + GGP("Ggp"), + IPV4("IPv4"), + TCP("Tcp"), + PUP("Pup"), + UDP("Udp"), + IDP("Idp"), + IPV6("IPv6"), + IPV6_ROUTING_HEADER("IPv6RoutingHeader"), + IPV6_FRAGMENT_HEADER("IPv6FragmentHeader"), + IPSEC_ENCAPSULATING_SECURITY_PAYLOAD("IPSecEncapsulatingSecurityPayload"), + IPSEC_AUTHENTICATION_HEADER("IPSecAuthenticationHeader"), + ICMP_V6("IcmpV6"), + IPV6_NO_NEXT_HEADER("IPv6NoNextHeader"), + IPV6_DESTINATION_OPTIONS("IPv6DestinationOptions"), + ND("ND"), + RAW("Raw"), + IPX("Ipx"), + SPX("Spx"), + SPX_II("SpxII"), + UNKNOWN("Unknown"); + + private final String value; - /** Configures pipeline step dependencies via a callback */ - public IResource withPipelineConfiguration(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withPipelineConfiguration", reqArgs); + ProtocolType(String value) { + this.value = value; } - /** Gets the resource name */ - public String getResourceName() { - Map reqArgs = new HashMap<>(); - reqArgs.put("resource", AspireClient.serializeValue(getHandle())); - return (String) getClient().invokeCapability("Aspire.Hosting/getResourceName", reqArgs); - } + public String getValue() { return value; } - /** Subscribes to the BeforeResourceStarted event */ - public IResource onBeforeResourceStarted(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + public static ProtocolType fromValue(String value) { + for (ProtocolType e : values()) { + if (e.value.equals(value)) return e; } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onBeforeResourceStarted", reqArgs); + throw new IllegalArgumentException("Unknown value: " + value); } +} - /** Subscribes to the ResourceStopped event */ - public IResource onResourceStopped(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onResourceStopped", reqArgs); - } +// ===== PublishResourceUpdateOptions.java ===== +// PublishResourceUpdateOptions.java - GENERATED CODE - DO NOT EDIT - /** Subscribes to the InitializeResource event */ - public IResource onInitializeResource(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onInitializeResource", reqArgs); +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Options for PublishResourceUpdate. */ +public final class PublishResourceUpdateOptions { + private String state; + private String stateStyle; + + public String getState() { return state; } + public PublishResourceUpdateOptions state(String value) { + this.state = value; + return this; } - /** Subscribes to the ResourceReady event */ - public IResource onResourceReady(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onResourceReady", reqArgs); + public String getStateStyle() { return stateStyle; } + public PublishResourceUpdateOptions stateStyle(String value) { + this.stateStyle = value; + return this; } - /** Adds an optional string parameter */ - public IResource withOptionalString(String value, Boolean enabled) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (value != null) { - reqArgs.put("value", AspireClient.serializeValue(value)); - } - if (enabled != null) { - reqArgs.put("enabled", AspireClient.serializeValue(enabled)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalString", reqArgs); +} + +// ===== ReferenceExpression.java ===== +// ReferenceExpression.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; + +/** + * ReferenceExpression represents a reference expression. + * Supports value mode (format + value providers), conditional mode, and handle mode. + */ +public class ReferenceExpression { + private final String format; + private final Object[] valueProviders; + private final Object condition; + private final ReferenceExpression whenTrue; + private final ReferenceExpression whenFalse; + private final String matchValue; + private final Handle handle; + private final AspireClient client; + + ReferenceExpression(String format, Object... valueProviders) { + this.format = format; + this.valueProviders = valueProviders; + this.condition = null; + this.whenTrue = null; + this.whenFalse = null; + this.matchValue = null; + this.handle = null; + this.client = null; } - /** Configures the resource with a DTO */ - public IResource withConfig(TestConfigDto config) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("config", AspireClient.serializeValue(config)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConfig", reqArgs); + private ReferenceExpression(Object condition, String matchValue, ReferenceExpression whenTrue, ReferenceExpression whenFalse) { + this.format = null; + this.valueProviders = null; + this.condition = condition; + this.whenTrue = whenTrue; + this.whenFalse = whenFalse; + this.matchValue = matchValue != null ? matchValue : "True"; + this.handle = null; + this.client = null; } - /** Sets the created timestamp */ - public IResource withCreatedAt(String createdAt) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("createdAt", AspireClient.serializeValue(createdAt)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCreatedAt", reqArgs); + ReferenceExpression(Handle handle, AspireClient client) { + this.format = null; + this.valueProviders = null; + this.condition = null; + this.whenTrue = null; + this.whenFalse = null; + this.matchValue = null; + this.handle = handle; + this.client = client; } - /** Sets the modified timestamp */ - public IResource withModifiedAt(String modifiedAt) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("modifiedAt", AspireClient.serializeValue(modifiedAt)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withModifiedAt", reqArgs); + boolean isConditional() { + return condition != null; } - /** Sets the correlation ID */ - public IResource withCorrelationId(String correlationId) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("correlationId", AspireClient.serializeValue(correlationId)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCorrelationId", reqArgs); + boolean isHandle() { + return handle != null; } - /** Configures with optional callback */ - public IResource withOptionalCallback(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + Map toJson() { + if (handle != null) { + return handle.toJson(); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalCallback", reqArgs); - } - /** Sets the resource status */ - public IResource withStatus(TestResourceStatus status) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("status", AspireClient.serializeValue(status)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withStatus", reqArgs); + Map expression = new HashMap<>(); + if (isConditional()) { + expression.put("condition", extractValueProvider(condition)); + expression.put("whenTrue", whenTrue.toJson()); + expression.put("whenFalse", whenFalse.toJson()); + expression.put("matchValue", matchValue); + } else { + expression.put("format", format); + if (valueProviders != null && valueProviders.length > 0) { + List providers = new ArrayList<>(valueProviders.length); + for (Object valueProvider : valueProviders) { + providers.add(extractValueProvider(valueProvider)); + } + expression.put("valueProviders", providers); + } + } + + Map result = new HashMap<>(); + result.put("$expr", expression); + return result; } - /** Configures with nested DTO */ - public IResource withNestedConfig(TestNestedDto config) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("config", AspireClient.serializeValue(config)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withNestedConfig", reqArgs); + public String getValue() { + return getValue(null); } - /** Adds validation callback */ - public IResource withValidator(Function validator) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (validator != null) { - reqArgs.put("validator", getClient().registerCallback(validator)); + public String getValue(CancellationToken cancellationToken) { + if (handle == null || client == null) { + throw new IllegalStateException("getValue is only available on server-returned ReferenceExpression instances"); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withValidator", reqArgs); - } - /** Waits for another resource (test version) */ - public IResource testWaitFor(IResource dependency) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWaitFor", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(handle)); + if (cancellationToken != null) { + reqArgs.put("cancellationToken", client.registerCancellation(cancellationToken)); + } + + return (String) client.invokeCapability("Aspire.Hosting.ApplicationModel/getValue", reqArgs); } - /** Adds a dependency on another resource */ - public IResource withDependency(IResourceWithConnectionString dependency) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDependency", reqArgs); + public static ReferenceExpression refExpr(String format, Object... valueProviders) { + return new ReferenceExpression(format, valueProviders); } - /** Sets the endpoints */ - public IResource withEndpoints(String[] endpoints) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("endpoints", AspireClient.serializeValue(endpoints)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEndpoints", reqArgs); + public static ReferenceExpression createConditional(Object condition, String matchValue, ReferenceExpression whenTrue, ReferenceExpression whenFalse) { + return new ReferenceExpression(condition, matchValue, whenTrue, whenFalse); } - /** Performs a cancellable operation */ - public IResource withCancellableOperation(Function operation) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (operation != null) { - reqArgs.put("operation", getClient().registerCallback(operation)); + private static Object extractValueProvider(Object value) { + if (value == null) { + throw new IllegalArgumentException("Cannot use null in a reference expression"); + } + + if (value instanceof String || value instanceof Number || value instanceof Boolean) { + return value; } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCancellableOperation", reqArgs); - } + return AspireClient.serializeValue(value); + } } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext. */ -class PipelineConfigurationContext extends HandleWrapperBase { - PipelineConfigurationContext(Handle handle, AspireClient client) { +// ===== ReferenceExpressionBuilder.java ===== +// ReferenceExpressionBuilder.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder. */ +public class ReferenceExpressionBuilder extends HandleWrapperBase { + ReferenceExpressionBuilder(Handle handle, AspireClient client) { super(handle, client); } - /** Gets the Services property */ - public IServiceProvider services() { + /** Gets the IsEmpty property */ + public boolean isEmpty() { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (IServiceProvider) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineConfigurationContext.services", reqArgs); + return (boolean) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ReferenceExpressionBuilder.isEmpty", reqArgs); } - /** Sets the Services property */ - public PipelineConfigurationContext setServices(IServiceProvider value) { + /** Appends a literal string to the reference expression */ + public void appendLiteral(String value) { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); reqArgs.put("value", AspireClient.serializeValue(value)); - return (PipelineConfigurationContext) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineConfigurationContext.setServices", reqArgs); + getClient().invokeCapability("Aspire.Hosting.ApplicationModel/appendLiteral", reqArgs); } - /** Gets the Steps property */ - public PipelineStep[] steps() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (PipelineStep[]) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineConfigurationContext.steps", reqArgs); + public void appendFormatted(String value) { + appendFormatted(value, null); } - /** Sets the Steps property */ - public PipelineConfigurationContext setSteps(PipelineStep[] value) { + /** Appends a formatted string value to the reference expression */ + public void appendFormatted(String value, String format) { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); reqArgs.put("value", AspireClient.serializeValue(value)); - return (PipelineConfigurationContext) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineConfigurationContext.setSteps", reqArgs); + if (format != null) { + reqArgs.put("format", AspireClient.serializeValue(format)); + } + getClient().invokeCapability("Aspire.Hosting.ApplicationModel/appendFormatted", reqArgs); } - /** Gets the Model property */ - public DistributedApplicationModel model() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (DistributedApplicationModel) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineConfigurationContext.model", reqArgs); + public void appendValueProvider(Object valueProvider) { + appendValueProvider(valueProvider, null); } - /** Sets the Model property */ - public PipelineConfigurationContext setModel(DistributedApplicationModel value) { + /** Appends a value provider to the reference expression */ + public void appendValueProvider(Object valueProvider, String format) { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (PipelineConfigurationContext) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineConfigurationContext.setModel", reqArgs); + reqArgs.put("valueProvider", AspireClient.serializeValue(valueProvider)); + if (format != null) { + reqArgs.put("format", AspireClient.serializeValue(format)); + } + getClient().invokeCapability("Aspire.Hosting.ApplicationModel/appendValueProvider", reqArgs); } - /** Gets pipeline steps with the specified tag */ - public PipelineStep[] getStepsByTag(String tag) { + /** Builds the reference expression */ + public ReferenceExpression build() { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); - reqArgs.put("tag", AspireClient.serializeValue(tag)); - return (PipelineStep[]) getClient().invokeCapability("Aspire.Hosting.Pipelines/getStepsByTag", reqArgs); + return (ReferenceExpression) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/build", reqArgs); } } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineContext. */ -class PipelineContext extends HandleWrapperBase { - PipelineContext(Handle handle, AspireClient client) { +// ===== ResourceBuilderBase.java ===== +// ResourceBuilderBase.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; + +/** + * ResourceBuilderBase extends HandleWrapperBase for resource builders. + */ +public class ResourceBuilderBase extends HandleWrapperBase { + ResourceBuilderBase(Handle handle, AspireClient client) { super(handle, client); } +} - /** Gets the Model property */ - public DistributedApplicationModel model() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (DistributedApplicationModel) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineContext.model", reqArgs); +// ===== ResourceEndpointsAllocatedEvent.java ===== +// ResourceEndpointsAllocatedEvent.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent. */ +public class ResourceEndpointsAllocatedEvent extends HandleWrapperBase { + ResourceEndpointsAllocatedEvent(Handle handle, AspireClient client) { + super(handle, client); } - /** Gets the ExecutionContext property */ - public DistributedApplicationExecutionContext executionContext() { + /** Gets the Resource property */ + public IResource resource() { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (DistributedApplicationExecutionContext) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineContext.executionContext", reqArgs); + return (IResource) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.resource", reqArgs); } /** Gets the Services property */ public IServiceProvider services() { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (IServiceProvider) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineContext.services", reqArgs); + return (IServiceProvider) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.services", reqArgs); + } + +} + +// ===== ResourceEventDto.java ===== +// ResourceEventDto.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** ResourceEventDto DTO. */ +public class ResourceEventDto { + private String resourceName; + private String resourceId; + private String state; + private String stateStyle; + private String healthStatus; + private double exitCode; + + public String getResourceName() { return resourceName; } + public void setResourceName(String value) { this.resourceName = value; } + public String getResourceId() { return resourceId; } + public void setResourceId(String value) { this.resourceId = value; } + public String getState() { return state; } + public void setState(String value) { this.state = value; } + public String getStateStyle() { return stateStyle; } + public void setStateStyle(String value) { this.stateStyle = value; } + public String getHealthStatus() { return healthStatus; } + public void setHealthStatus(String value) { this.healthStatus = value; } + public double getExitCode() { return exitCode; } + public void setExitCode(double value) { this.exitCode = value; } + + public Map toMap() { + Map map = new HashMap<>(); + map.put("ResourceName", AspireClient.serializeValue(resourceName)); + map.put("ResourceId", AspireClient.serializeValue(resourceId)); + map.put("State", AspireClient.serializeValue(state)); + map.put("StateStyle", AspireClient.serializeValue(stateStyle)); + map.put("HealthStatus", AspireClient.serializeValue(healthStatus)); + map.put("ExitCode", AspireClient.serializeValue(exitCode)); + return map; } +} - /** Gets the Logger property */ - public ILogger logger() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (ILogger) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineContext.logger", reqArgs); +// ===== ResourceLoggerService.java ===== +// ResourceLoggerService.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService. */ +public class ResourceLoggerService extends HandleWrapperBase { + ResourceLoggerService(Handle handle, AspireClient client) { + super(handle, client); } - /** Gets the CancellationToken property */ - public CancellationToken cancellationToken() { + /** Completes the log stream for a resource */ + public void completeLog(IResource resource) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (CancellationToken) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineContext.cancellationToken", reqArgs); + reqArgs.put("loggerService", AspireClient.serializeValue(getHandle())); + reqArgs.put("resource", AspireClient.serializeValue(resource)); + getClient().invokeCapability("Aspire.Hosting/completeLog", reqArgs); } - /** Sets the CancellationToken property */ - public PipelineContext setCancellationToken(CancellationToken value) { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - if (value != null) { - reqArgs.put("value", getClient().registerCancellation(value)); - } - return (PipelineContext) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineContext.setCancellationToken", reqArgs); + public void completeLog(ResourceBuilderBase resource) { + completeLog(new IResource(resource.getHandle(), resource.getClient())); } - /** Gets the Summary property */ - public PipelineSummary summary() { + /** Completes the log stream by resource name */ + public void completeLogByName(String resourceName) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (PipelineSummary) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineContext.summary", reqArgs); + reqArgs.put("loggerService", AspireClient.serializeValue(getHandle())); + reqArgs.put("resourceName", AspireClient.serializeValue(resourceName)); + getClient().invokeCapability("Aspire.Hosting/completeLogByName", reqArgs); } } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep. */ -class PipelineStep extends HandleWrapperBase { - PipelineStep(Handle handle, AspireClient client) { +// ===== ResourceNotificationService.java ===== +// ResourceNotificationService.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService. */ +public class ResourceNotificationService extends HandleWrapperBase { + ResourceNotificationService(Handle handle, AspireClient client) { super(handle, client); } - /** Gets the Name property */ - public String name() { + public void waitForResourceState(String resourceName) { + waitForResourceState(resourceName, null); + } + + /** Waits for a resource to reach a specified state */ + public void waitForResourceState(String resourceName, String targetState) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (String) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStep.name", reqArgs); + reqArgs.put("notificationService", AspireClient.serializeValue(getHandle())); + reqArgs.put("resourceName", AspireClient.serializeValue(resourceName)); + if (targetState != null) { + reqArgs.put("targetState", AspireClient.serializeValue(targetState)); + } + getClient().invokeCapability("Aspire.Hosting/waitForResourceState", reqArgs); } - /** Sets the Name property */ - public PipelineStep setName(String value) { + /** Waits for a resource to reach one of the specified states */ + public String waitForResourceStates(String resourceName, String[] targetStates) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (PipelineStep) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStep.setName", reqArgs); + reqArgs.put("notificationService", AspireClient.serializeValue(getHandle())); + reqArgs.put("resourceName", AspireClient.serializeValue(resourceName)); + reqArgs.put("targetStates", AspireClient.serializeValue(targetStates)); + return (String) getClient().invokeCapability("Aspire.Hosting/waitForResourceStates", reqArgs); } - /** Gets the Description property */ - public String description() { + /** Waits for a resource to become healthy */ + public ResourceEventDto waitForResourceHealthy(String resourceName) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (String) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStep.description", reqArgs); + reqArgs.put("notificationService", AspireClient.serializeValue(getHandle())); + reqArgs.put("resourceName", AspireClient.serializeValue(resourceName)); + return (ResourceEventDto) getClient().invokeCapability("Aspire.Hosting/waitForResourceHealthy", reqArgs); } - /** Sets the Description property */ - public PipelineStep setDescription(String value) { + /** Waits for all dependencies of a resource to be ready */ + public void waitForDependencies(IResource resource) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (PipelineStep) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStep.setDescription", reqArgs); + reqArgs.put("notificationService", AspireClient.serializeValue(getHandle())); + reqArgs.put("resource", AspireClient.serializeValue(resource)); + getClient().invokeCapability("Aspire.Hosting/waitForDependencies", reqArgs); } - /** Gets the DependsOnSteps property */ - private AspireList dependsOnStepsField; - public AspireList dependsOnSteps() { - if (dependsOnStepsField == null) { - dependsOnStepsField = new AspireList<>(getHandle(), getClient(), "Aspire.Hosting.Pipelines/PipelineStep.dependsOnSteps"); - } - return dependsOnStepsField; + public void waitForDependencies(ResourceBuilderBase resource) { + waitForDependencies(new IResource(resource.getHandle(), resource.getClient())); } - /** Sets the DependsOnSteps property */ - public PipelineStep setDependsOnSteps(AspireList value) { + /** Tries to get the current state of a resource */ + public ResourceEventDto tryGetResourceState(String resourceName) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (PipelineStep) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStep.setDependsOnSteps", reqArgs); + reqArgs.put("notificationService", AspireClient.serializeValue(getHandle())); + reqArgs.put("resourceName", AspireClient.serializeValue(resourceName)); + return (ResourceEventDto) getClient().invokeCapability("Aspire.Hosting/tryGetResourceState", reqArgs); } - /** Gets the RequiredBySteps property */ - private AspireList requiredByStepsField; - public AspireList requiredBySteps() { - if (requiredByStepsField == null) { - requiredByStepsField = new AspireList<>(getHandle(), getClient(), "Aspire.Hosting.Pipelines/PipelineStep.requiredBySteps"); - } - return requiredByStepsField; + /** Publishes an update for a resource's state */ + public void publishResourceUpdate(IResource resource, PublishResourceUpdateOptions options) { + var state = options == null ? null : options.getState(); + var stateStyle = options == null ? null : options.getStateStyle(); + publishResourceUpdateImpl(resource, state, stateStyle); } - /** Sets the RequiredBySteps property */ - public PipelineStep setRequiredBySteps(AspireList value) { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (PipelineStep) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStep.setRequiredBySteps", reqArgs); + public void publishResourceUpdate(ResourceBuilderBase resource, PublishResourceUpdateOptions options) { + publishResourceUpdate(new IResource(resource.getHandle(), resource.getClient()), options); } - /** Gets the Tags property */ - private AspireList tagsField; - public AspireList tags() { - if (tagsField == null) { - tagsField = new AspireList<>(getHandle(), getClient(), "Aspire.Hosting.Pipelines/PipelineStep.tags"); - } - return tagsField; + public void publishResourceUpdate(IResource resource) { + publishResourceUpdate(resource, null); } - /** Sets the Tags property */ - public PipelineStep setTags(AspireList value) { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (PipelineStep) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStep.setTags", reqArgs); + public void publishResourceUpdate(ResourceBuilderBase resource) { + publishResourceUpdate(new IResource(resource.getHandle(), resource.getClient())); } - /** Gets the Resource property */ - public IResource resource() { + /** Publishes an update for a resource's state */ + private void publishResourceUpdateImpl(IResource resource, String state, String stateStyle) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStep.resource", reqArgs); + reqArgs.put("notificationService", AspireClient.serializeValue(getHandle())); + reqArgs.put("resource", AspireClient.serializeValue(resource)); + if (state != null) { + reqArgs.put("state", AspireClient.serializeValue(state)); + } + if (stateStyle != null) { + reqArgs.put("stateStyle", AspireClient.serializeValue(stateStyle)); + } + getClient().invokeCapability("Aspire.Hosting/publishResourceUpdate", reqArgs); } - /** Sets the Resource property */ - public PipelineStep setResource(IResource value) { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (PipelineStep) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStep.setResource", reqArgs); +} + +// ===== ResourceReadyEvent.java ===== +// ResourceReadyEvent.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceReadyEvent. */ +public class ResourceReadyEvent extends HandleWrapperBase { + ResourceReadyEvent(Handle handle, AspireClient client) { + super(handle, client); } - /** Adds a dependency on another step by name */ - public void dependsOn(String stepName) { + /** Gets the Resource property */ + public IResource resource() { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); - reqArgs.put("stepName", AspireClient.serializeValue(stepName)); - getClient().invokeCapability("Aspire.Hosting.Pipelines/dependsOn", reqArgs); + return (IResource) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ResourceReadyEvent.resource", reqArgs); } - /** Specifies that another step requires this step by name */ - public void requiredBy(String stepName) { + /** Gets the Services property */ + public IServiceProvider services() { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); - reqArgs.put("stepName", AspireClient.serializeValue(stepName)); - getClient().invokeCapability("Aspire.Hosting.Pipelines/requiredBy", reqArgs); + return (IServiceProvider) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ResourceReadyEvent.services", reqArgs); } } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext. */ -class PipelineStepContext extends HandleWrapperBase { - PipelineStepContext(Handle handle, AspireClient client) { +// ===== ResourceStoppedEvent.java ===== +// ResourceStoppedEvent.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceStoppedEvent. */ +public class ResourceStoppedEvent extends HandleWrapperBase { + ResourceStoppedEvent(Handle handle, AspireClient client) { super(handle, client); } - /** Gets the PipelineContext property */ - public PipelineContext pipelineContext() { + /** Gets the Resource property */ + public IResource resource() { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (PipelineContext) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStepContext.pipelineContext", reqArgs); + return (IResource) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.resource", reqArgs); } - /** Sets the PipelineContext property */ - public PipelineStepContext setPipelineContext(PipelineContext value) { + /** Gets the Services property */ + public IServiceProvider services() { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (PipelineStepContext) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStepContext.setPipelineContext", reqArgs); + return (IServiceProvider) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.services", reqArgs); } - /** Gets the ReportingStep property */ - public IReportingStep reportingStep() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (IReportingStep) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStepContext.reportingStep", reqArgs); +} + +// ===== ResourceUrlAnnotation.java ===== +// ResourceUrlAnnotation.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** ResourceUrlAnnotation DTO. */ +public class ResourceUrlAnnotation { + private String url; + private String displayText; + private EndpointReference endpoint; + private UrlDisplayLocation displayLocation; + + public String getUrl() { return url; } + public void setUrl(String value) { this.url = value; } + public String getDisplayText() { return displayText; } + public void setDisplayText(String value) { this.displayText = value; } + public EndpointReference getEndpoint() { return endpoint; } + public void setEndpoint(EndpointReference value) { this.endpoint = value; } + public UrlDisplayLocation getDisplayLocation() { return displayLocation; } + public void setDisplayLocation(UrlDisplayLocation value) { this.displayLocation = value; } + + public Map toMap() { + Map map = new HashMap<>(); + map.put("Url", AspireClient.serializeValue(url)); + map.put("DisplayText", AspireClient.serializeValue(displayText)); + map.put("Endpoint", AspireClient.serializeValue(endpoint)); + map.put("DisplayLocation", AspireClient.serializeValue(displayLocation)); + return map; } +} - /** Sets the ReportingStep property */ - public PipelineStepContext setReportingStep(IReportingStep value) { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (PipelineStepContext) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStepContext.setReportingStep", reqArgs); +// ===== ResourceUrlsCallbackContext.java ===== +// ResourceUrlsCallbackContext.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext. */ +public class ResourceUrlsCallbackContext extends HandleWrapperBase { + ResourceUrlsCallbackContext(Handle handle, AspireClient client) { + super(handle, client); } - /** Gets the Model property */ - public DistributedApplicationModel model() { + /** Gets the Resource property */ + public IResource resource() { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (DistributedApplicationModel) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStepContext.model", reqArgs); + return (IResource) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.resource", reqArgs); } - /** Gets the ExecutionContext property */ - public DistributedApplicationExecutionContext executionContext() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (DistributedApplicationExecutionContext) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStepContext.executionContext", reqArgs); + /** Gets the Urls property */ + private AspireList urlsField; + public AspireList urls() { + if (urlsField == null) { + urlsField = new AspireList<>(getHandle(), getClient(), "Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls"); + } + return urlsField; } - /** Gets the Services property */ - public IServiceProvider services() { + /** Gets the CancellationToken property */ + public CancellationToken cancellationToken() { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (IServiceProvider) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStepContext.services", reqArgs); + return (CancellationToken) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken", reqArgs); } /** Gets the Logger property */ public ILogger logger() { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (ILogger) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStepContext.logger", reqArgs); + return (ILogger) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.logger", reqArgs); } - /** Gets the CancellationToken property */ - public CancellationToken cancellationToken() { + /** Sets the Logger property */ + public ResourceUrlsCallbackContext setLogger(ILogger value) { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (CancellationToken) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStepContext.cancellationToken", reqArgs); + reqArgs.put("value", AspireClient.serializeValue(value)); + return (ResourceUrlsCallbackContext) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.setLogger", reqArgs); } - /** Gets the Summary property */ - public PipelineSummary summary() { + public ResourceUrlsCallbackContext setLogger(HandleWrapperBase value) { + return setLogger(new ILogger(value.getHandle(), value.getClient())); + } + + /** Gets the ExecutionContext property */ + public DistributedApplicationExecutionContext executionContext() { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (PipelineSummary) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStepContext.summary", reqArgs); + return (DistributedApplicationExecutionContext) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext", reqArgs); } } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepFactoryContext. */ -class PipelineStepFactoryContext extends HandleWrapperBase { - PipelineStepFactoryContext(Handle handle, AspireClient client) { +// ===== TestCallbackContext.java ===== +// TestCallbackContext.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestCallbackContext. */ +public class TestCallbackContext extends HandleWrapperBase { + TestCallbackContext(Handle handle, AspireClient client) { super(handle, client); } - /** Gets the PipelineContext property */ - public PipelineContext pipelineContext() { + /** Gets the Name property */ + public String name() { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (PipelineContext) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStepFactoryContext.pipelineContext", reqArgs); + return (String) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestCallbackContext.name", reqArgs); } - /** Sets the PipelineContext property */ - public PipelineStepFactoryContext setPipelineContext(PipelineContext value) { + /** Sets the Name property */ + public TestCallbackContext setName(String value) { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); reqArgs.put("value", AspireClient.serializeValue(value)); - return (PipelineStepFactoryContext) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStepFactoryContext.setPipelineContext", reqArgs); + return (TestCallbackContext) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestCallbackContext.setName", reqArgs); } - /** Gets the Resource property */ - public IResource resource() { + /** Gets the Value property */ + public double value() { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStepFactoryContext.resource", reqArgs); + return (double) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestCallbackContext.value", reqArgs); } - /** Sets the Resource property */ - public PipelineStepFactoryContext setResource(IResource value) { + /** Sets the Value property */ + public TestCallbackContext setValue(double value) { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); reqArgs.put("value", AspireClient.serializeValue(value)); - return (PipelineStepFactoryContext) getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineStepFactoryContext.setResource", reqArgs); - } - -} - -/** Wrapper for Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineSummary. */ -class PipelineSummary extends HandleWrapperBase { - PipelineSummary(Handle handle, AspireClient client) { - super(handle, client); + return (TestCallbackContext) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestCallbackContext.setValue", reqArgs); } - /** Invokes the Add method */ - public void add(String key, String value) { + /** Gets the CancellationToken property */ + public CancellationToken cancellationToken() { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); - reqArgs.put("key", AspireClient.serializeValue(key)); - reqArgs.put("value", AspireClient.serializeValue(value)); - getClient().invokeCapability("Aspire.Hosting.Pipelines/PipelineSummary.add", reqArgs); + return (CancellationToken) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestCallbackContext.cancellationToken", reqArgs); } - /** Adds a Markdown-formatted value to the pipeline summary */ - public void addMarkdown(String key, String markdownString) { + /** Sets the CancellationToken property */ + public TestCallbackContext setCancellationToken(CancellationToken value) { Map reqArgs = new HashMap<>(); - reqArgs.put("summary", AspireClient.serializeValue(getHandle())); - reqArgs.put("key", AspireClient.serializeValue(key)); - reqArgs.put("markdownString", AspireClient.serializeValue(markdownString)); - getClient().invokeCapability("Aspire.Hosting/addMarkdown", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + if (value != null) { + reqArgs.put("value", getClient().registerCancellation(value)); + } + return (TestCallbackContext) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestCallbackContext.setCancellationToken", reqArgs); } } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource. */ -class ProjectResource extends ResourceBuilderBase { - ProjectResource(Handle handle, AspireClient client) { - super(handle, client); - } +// ===== TestCollectionContext.java ===== +// TestCollectionContext.java - GENERATED CODE - DO NOT EDIT - /** Configures a resource to use a container registry */ - public IResource withContainerRegistry(IResource registry) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("registry", AspireClient.serializeValue(registry)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withContainerRegistry", reqArgs); +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestCollectionContext. */ +public class TestCollectionContext extends HandleWrapperBase { + TestCollectionContext(Handle handle, AspireClient client) { + super(handle, client); } - /** Sets the base image for a Dockerfile build */ - public IResource withDockerfileBaseImage(String buildImage, String runtimeImage) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (buildImage != null) { - reqArgs.put("buildImage", AspireClient.serializeValue(buildImage)); - } - if (runtimeImage != null) { - reqArgs.put("runtimeImage", AspireClient.serializeValue(runtimeImage)); + /** Gets the Items property */ + private AspireList itemsField; + public AspireList items() { + if (itemsField == null) { + itemsField = new AspireList<>(getHandle(), getClient(), "Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestCollectionContext.items"); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withDockerfileBaseImage", reqArgs); + return itemsField; } - /** Configures an MCP server endpoint on the resource */ - public IResourceWithEndpoints withMcpServer(String path, String endpointName) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (path != null) { - reqArgs.put("path", AspireClient.serializeValue(path)); - } - if (endpointName != null) { - reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + /** Gets the Metadata property */ + private AspireDict metadataField; + public AspireDict metadata() { + if (metadataField == null) { + metadataField = new AspireDict<>(getHandle(), getClient(), "Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestCollectionContext.metadata"); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withMcpServer", reqArgs); + return metadataField; } - /** Configures OTLP telemetry export */ - public IResourceWithEnvironment withOtlpExporter() { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withOtlpExporter", reqArgs); +} + +// ===== TestConfigDto.java ===== +// TestConfigDto.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** TestConfigDto DTO. */ +public class TestConfigDto { + private String name; + private double port; + private boolean enabled; + private String optionalField; + + public String getName() { return name; } + public void setName(String value) { this.name = value; } + public double getPort() { return port; } + public void setPort(double value) { this.port = value; } + public boolean getEnabled() { return enabled; } + public void setEnabled(boolean value) { this.enabled = value; } + public String getOptionalField() { return optionalField; } + public void setOptionalField(String value) { this.optionalField = value; } + + public Map toMap() { + Map map = new HashMap<>(); + map.put("Name", AspireClient.serializeValue(name)); + map.put("Port", AspireClient.serializeValue(port)); + map.put("Enabled", AspireClient.serializeValue(enabled)); + map.put("OptionalField", AspireClient.serializeValue(optionalField)); + return map; } +} - /** Configures OTLP telemetry export with specific protocol */ - public IResourceWithEnvironment withOtlpExporterProtocol(OtlpProtocol protocol) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("protocol", AspireClient.serializeValue(protocol)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withOtlpExporterProtocol", reqArgs); +// ===== TestDatabaseResource.java ===== +// TestDatabaseResource.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestDatabaseResource. */ +public class TestDatabaseResource extends ResourceBuilderBase { + TestDatabaseResource(Handle handle, AspireClient client) { + super(handle, client); } - /** Sets the number of replicas */ - public ProjectResource withReplicas(double replicas) { + /** Configures a resource to use a container registry */ + public TestDatabaseResource withContainerRegistry(IResource registry) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("replicas", AspireClient.serializeValue(replicas)); - return (ProjectResource) getClient().invokeCapability("Aspire.Hosting/withReplicas", reqArgs); + reqArgs.put("registry", AspireClient.serializeValue(registry)); + getClient().invokeCapability("Aspire.Hosting/withContainerRegistry", reqArgs); + return this; } - /** Disables forwarded headers for the project */ - public ProjectResource disableForwardedHeaders() { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (ProjectResource) getClient().invokeCapability("Aspire.Hosting/disableForwardedHeaders", reqArgs); + public TestDatabaseResource withContainerRegistry(ResourceBuilderBase registry) { + return withContainerRegistry(new IResource(registry.getHandle(), registry.getClient())); } - /** Publishes a project as a Docker file with optional container configuration */ - public ProjectResource publishAsDockerFile(Function configure) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (configure != null) { - reqArgs.put("configure", getClient().registerCallback(configure)); - } - return (ProjectResource) getClient().invokeCapability("Aspire.Hosting/publishProjectAsDockerFileWithConfigure", reqArgs); + public TestDatabaseResource withBindMount(String source, String target) { + return withBindMount(source, target, null); } - /** Adds a required command dependency */ - public IResource withRequiredCommand(String command, String helpLink) { + /** Adds a bind mount */ + public TestDatabaseResource withBindMount(String source, String target, Boolean isReadOnly) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("command", AspireClient.serializeValue(command)); - if (helpLink != null) { - reqArgs.put("helpLink", AspireClient.serializeValue(helpLink)); + reqArgs.put("source", AspireClient.serializeValue(source)); + reqArgs.put("target", AspireClient.serializeValue(target)); + if (isReadOnly != null) { + reqArgs.put("isReadOnly", AspireClient.serializeValue(isReadOnly)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withRequiredCommand", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withBindMount", reqArgs); + return this; } - /** Sets an environment variable */ - public IResourceWithEnvironment withEnvironment(String name, String value) { + /** Sets the container entrypoint */ + public TestDatabaseResource withEntrypoint(String entrypoint) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironment", reqArgs); + reqArgs.put("entrypoint", AspireClient.serializeValue(entrypoint)); + getClient().invokeCapability("Aspire.Hosting/withEntrypoint", reqArgs); + return this; } - /** Adds an environment variable with a reference expression */ - public IResourceWithEnvironment withEnvironmentExpression(String name, ReferenceExpression value) { + /** Sets the container image tag */ + public TestDatabaseResource withImageTag(String tag) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentExpression", reqArgs); + reqArgs.put("tag", AspireClient.serializeValue(tag)); + getClient().invokeCapability("Aspire.Hosting/withImageTag", reqArgs); + return this; } - /** Sets environment variables via callback */ - public IResourceWithEnvironment withEnvironmentCallback(Function callback) { + /** Sets the container image registry */ + public TestDatabaseResource withImageRegistry(String registry) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentCallback", reqArgs); + reqArgs.put("registry", AspireClient.serializeValue(registry)); + getClient().invokeCapability("Aspire.Hosting/withImageRegistry", reqArgs); + return this; } - /** Sets environment variables via async callback */ - public IResourceWithEnvironment withEnvironmentCallbackAsync(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentCallbackAsync", reqArgs); + public TestDatabaseResource withImage(String image) { + return withImage(image, null); } - /** Sets an environment variable from an endpoint reference */ - public IResourceWithEnvironment withEnvironmentEndpoint(String name, EndpointReference endpointReference) { + /** Sets the container image */ + public TestDatabaseResource withImage(String image, String tag) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("endpointReference", AspireClient.serializeValue(endpointReference)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentEndpoint", reqArgs); + reqArgs.put("image", AspireClient.serializeValue(image)); + if (tag != null) { + reqArgs.put("tag", AspireClient.serializeValue(tag)); + } + getClient().invokeCapability("Aspire.Hosting/withImage", reqArgs); + return this; } - /** Sets an environment variable from a parameter resource */ - public IResourceWithEnvironment withEnvironmentParameter(String name, ParameterResource parameter) { + /** Sets the image SHA256 digest */ + public TestDatabaseResource withImageSHA256(String sha256) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("parameter", AspireClient.serializeValue(parameter)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentParameter", reqArgs); + reqArgs.put("sha256", AspireClient.serializeValue(sha256)); + getClient().invokeCapability("Aspire.Hosting/withImageSHA256", reqArgs); + return this; } - /** Sets an environment variable from a connection string resource */ - public IResourceWithEnvironment withEnvironmentConnectionString(String envVarName, IResourceWithConnectionString resource) { + /** Adds runtime arguments for the container */ + public TestDatabaseResource withContainerRuntimeArgs(String[] args) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("envVarName", AspireClient.serializeValue(envVarName)); - reqArgs.put("resource", AspireClient.serializeValue(resource)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentConnectionString", reqArgs); + reqArgs.put("args", AspireClient.serializeValue(args)); + getClient().invokeCapability("Aspire.Hosting/withContainerRuntimeArgs", reqArgs); + return this; } - /** Adds arguments */ - public IResourceWithArgs withArgs(String[] args) { + /** Sets the lifetime behavior of the container resource */ + public TestDatabaseResource withLifetime(ContainerLifetime lifetime) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("args", AspireClient.serializeValue(args)); - return (IResourceWithArgs) getClient().invokeCapability("Aspire.Hosting/withArgs", reqArgs); + reqArgs.put("lifetime", AspireClient.serializeValue(lifetime)); + getClient().invokeCapability("Aspire.Hosting/withLifetime", reqArgs); + return this; } - /** Sets command-line arguments via callback */ - public IResourceWithArgs withArgsCallback(Function callback) { + /** Sets the container image pull policy */ + public TestDatabaseResource withImagePullPolicy(ImagePullPolicy pullPolicy) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResourceWithArgs) getClient().invokeCapability("Aspire.Hosting/withArgsCallback", reqArgs); + reqArgs.put("pullPolicy", AspireClient.serializeValue(pullPolicy)); + getClient().invokeCapability("Aspire.Hosting/withImagePullPolicy", reqArgs); + return this; } - /** Sets command-line arguments via async callback */ - public IResourceWithArgs withArgsCallbackAsync(Function callback) { + /** Configures the resource to be published as a container */ + public TestDatabaseResource publishAsContainer() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResourceWithArgs) getClient().invokeCapability("Aspire.Hosting/withArgsCallbackAsync", reqArgs); + getClient().invokeCapability("Aspire.Hosting/publishAsContainer", reqArgs); + return this; } - /** Adds a reference to another resource */ - public IResourceWithEnvironment withReference(IResource source, String connectionName, Boolean optional, String name) { + /** Configures the resource to use a Dockerfile */ + public TestDatabaseResource withDockerfile(String contextPath, WithDockerfileOptions options) { + var dockerfilePath = options == null ? null : options.getDockerfilePath(); + var stage = options == null ? null : options.getStage(); + return withDockerfileImpl(contextPath, dockerfilePath, stage); + } + + public TestDatabaseResource withDockerfile(String contextPath) { + return withDockerfile(contextPath, null); + } + + /** Configures the resource to use a Dockerfile */ + private TestDatabaseResource withDockerfileImpl(String contextPath, String dockerfilePath, String stage) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("source", AspireClient.serializeValue(source)); - if (connectionName != null) { - reqArgs.put("connectionName", AspireClient.serializeValue(connectionName)); - } - if (optional != null) { - reqArgs.put("optional", AspireClient.serializeValue(optional)); + reqArgs.put("contextPath", AspireClient.serializeValue(contextPath)); + if (dockerfilePath != null) { + reqArgs.put("dockerfilePath", AspireClient.serializeValue(dockerfilePath)); } - if (name != null) { - reqArgs.put("name", AspireClient.serializeValue(name)); + if (stage != null) { + reqArgs.put("stage", AspireClient.serializeValue(stage)); } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withReference", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withDockerfile", reqArgs); + return this; } - /** Adds a reference to a URI */ - public IResourceWithEnvironment withReferenceUri(String name, String uri) { + /** Sets the container name */ + public TestDatabaseResource withContainerName(String name) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("uri", AspireClient.serializeValue(uri)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withReferenceUri", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withContainerName", reqArgs); + return this; } - /** Adds a reference to an external service */ - public IResourceWithEnvironment withReferenceExternalService(ExternalServiceResource externalService) { + /** Adds a build argument from a parameter resource */ + public TestDatabaseResource withBuildArg(String name, ParameterResource value) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("externalService", AspireClient.serializeValue(externalService)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withReferenceExternalService", reqArgs); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("value", AspireClient.serializeValue(value)); + getClient().invokeCapability("Aspire.Hosting/withBuildArg", reqArgs); + return this; } - /** Adds a reference to an endpoint */ - public IResourceWithEnvironment withReferenceEndpoint(EndpointReference endpointReference) { + /** Adds a build secret from a parameter resource */ + public TestDatabaseResource withBuildSecret(String name, ParameterResource value) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("endpointReference", AspireClient.serializeValue(endpointReference)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withReferenceEndpoint", reqArgs); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("value", AspireClient.serializeValue(value)); + getClient().invokeCapability("Aspire.Hosting/withBuildSecret", reqArgs); + return this; } - /** Adds a network endpoint */ - public IResourceWithEndpoints withEndpoint(Double port, Double targetPort, String scheme, String name, String env, Boolean isProxied, Boolean isExternal, ProtocolType protocol) { + /** Configures endpoint proxy support */ + public TestDatabaseResource withEndpointProxySupport(boolean proxyEnabled) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (port != null) { - reqArgs.put("port", AspireClient.serializeValue(port)); - } - if (targetPort != null) { - reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); - } - if (scheme != null) { - reqArgs.put("scheme", AspireClient.serializeValue(scheme)); - } - if (name != null) { - reqArgs.put("name", AspireClient.serializeValue(name)); - } - if (env != null) { - reqArgs.put("env", AspireClient.serializeValue(env)); - } - if (isProxied != null) { - reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); - } - if (isExternal != null) { - reqArgs.put("isExternal", AspireClient.serializeValue(isExternal)); - } - if (protocol != null) { - reqArgs.put("protocol", AspireClient.serializeValue(protocol)); - } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withEndpoint", reqArgs); + reqArgs.put("proxyEnabled", AspireClient.serializeValue(proxyEnabled)); + getClient().invokeCapability("Aspire.Hosting/withEndpointProxySupport", reqArgs); + return this; } - /** Adds an HTTP endpoint */ - public IResourceWithEndpoints withHttpEndpoint(Double port, Double targetPort, String name, String env, Boolean isProxied) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (port != null) { - reqArgs.put("port", AspireClient.serializeValue(port)); - } - if (targetPort != null) { - reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); - } - if (name != null) { - reqArgs.put("name", AspireClient.serializeValue(name)); - } - if (env != null) { - reqArgs.put("env", AspireClient.serializeValue(env)); - } - if (isProxied != null) { - reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); - } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withHttpEndpoint", reqArgs); + /** Sets the base image for a Dockerfile build */ + public TestDatabaseResource withDockerfileBaseImage(WithDockerfileBaseImageOptions options) { + var buildImage = options == null ? null : options.getBuildImage(); + var runtimeImage = options == null ? null : options.getRuntimeImage(); + return withDockerfileBaseImageImpl(buildImage, runtimeImage); } - /** Adds an HTTPS endpoint */ - public IResourceWithEndpoints withHttpsEndpoint(Double port, Double targetPort, String name, String env, Boolean isProxied) { + public TestDatabaseResource withDockerfileBaseImage() { + return withDockerfileBaseImage(null); + } + + /** Sets the base image for a Dockerfile build */ + private TestDatabaseResource withDockerfileBaseImageImpl(String buildImage, String runtimeImage) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (port != null) { - reqArgs.put("port", AspireClient.serializeValue(port)); - } - if (targetPort != null) { - reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); - } - if (name != null) { - reqArgs.put("name", AspireClient.serializeValue(name)); - } - if (env != null) { - reqArgs.put("env", AspireClient.serializeValue(env)); + if (buildImage != null) { + reqArgs.put("buildImage", AspireClient.serializeValue(buildImage)); } - if (isProxied != null) { - reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); + if (runtimeImage != null) { + reqArgs.put("runtimeImage", AspireClient.serializeValue(runtimeImage)); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withHttpsEndpoint", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withDockerfileBaseImage", reqArgs); + return this; } - /** Makes HTTP endpoints externally accessible */ - public IResourceWithEndpoints withExternalHttpEndpoints() { + /** Adds a network alias for the container */ + public TestDatabaseResource withContainerNetworkAlias(String alias) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withExternalHttpEndpoints", reqArgs); + reqArgs.put("alias", AspireClient.serializeValue(alias)); + getClient().invokeCapability("Aspire.Hosting/withContainerNetworkAlias", reqArgs); + return this; } - /** Gets an endpoint reference */ - public EndpointReference getEndpoint(String name) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - return (EndpointReference) getClient().invokeCapability("Aspire.Hosting/getEndpoint", reqArgs); + /** Configures an MCP server endpoint on the resource */ + public TestDatabaseResource withMcpServer(WithMcpServerOptions options) { + var path = options == null ? null : options.getPath(); + var endpointName = options == null ? null : options.getEndpointName(); + return withMcpServerImpl(path, endpointName); } - /** Configures resource for HTTP/2 */ - public IResourceWithEndpoints asHttp2Service() { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/asHttp2Service", reqArgs); + public TestDatabaseResource withMcpServer() { + return withMcpServer(null); } - /** Customizes displayed URLs via callback */ - public IResource withUrlsCallback(Function callback) { + /** Configures an MCP server endpoint on the resource */ + private TestDatabaseResource withMcpServerImpl(String path, String endpointName) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + if (path != null) { + reqArgs.put("path", AspireClient.serializeValue(path)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlsCallback", reqArgs); + if (endpointName != null) { + reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + } + getClient().invokeCapability("Aspire.Hosting/withMcpServer", reqArgs); + return this; } - /** Customizes displayed URLs via async callback */ - public IResource withUrlsCallbackAsync(Function callback) { + /** Configures OTLP telemetry export */ + public TestDatabaseResource withOtlpExporter() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlsCallbackAsync", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withOtlpExporter", reqArgs); + return this; } - /** Adds or modifies displayed URLs */ - public IResource withUrl(String url, String displayText) { + /** Configures OTLP telemetry export with specific protocol */ + public TestDatabaseResource withOtlpExporterProtocol(OtlpProtocol protocol) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("url", AspireClient.serializeValue(url)); - if (displayText != null) { - reqArgs.put("displayText", AspireClient.serializeValue(displayText)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrl", reqArgs); + reqArgs.put("protocol", AspireClient.serializeValue(protocol)); + getClient().invokeCapability("Aspire.Hosting/withOtlpExporterProtocol", reqArgs); + return this; } - /** Adds a URL using a reference expression */ - public IResource withUrlExpression(ReferenceExpression url, String displayText) { + /** Publishes the resource as a connection string */ + public TestDatabaseResource publishAsConnectionString() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("url", AspireClient.serializeValue(url)); - if (displayText != null) { - reqArgs.put("displayText", AspireClient.serializeValue(displayText)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlExpression", reqArgs); + getClient().invokeCapability("Aspire.Hosting/publishAsConnectionString", reqArgs); + return this; } - /** Customizes the URL for a specific endpoint via callback */ - public IResource withUrlForEndpoint(String endpointName, Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlForEndpoint", reqArgs); + public TestDatabaseResource withRequiredCommand(String command) { + return withRequiredCommand(command, null); } - /** Adds a URL for a specific endpoint via factory callback */ - public IResourceWithEndpoints withUrlForEndpointFactory(String endpointName, Function callback) { + /** Adds a required command dependency */ + public TestDatabaseResource withRequiredCommand(String command, String helpLink) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + reqArgs.put("command", AspireClient.serializeValue(command)); + if (helpLink != null) { + reqArgs.put("helpLink", AspireClient.serializeValue(helpLink)); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withUrlForEndpointFactory", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withRequiredCommand", reqArgs); + return this; } - /** Configures the resource to copy container files from the specified source during publishing */ - public IContainerFilesDestinationResource publishWithContainerFiles(IResourceWithContainerFiles source, String destinationPath) { + /** Sets an environment variable */ + public TestDatabaseResource withEnvironment(String name, String value) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("source", AspireClient.serializeValue(source)); - reqArgs.put("destinationPath", AspireClient.serializeValue(destinationPath)); - return (IContainerFilesDestinationResource) getClient().invokeCapability("Aspire.Hosting/publishWithContainerFiles", reqArgs); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("value", AspireClient.serializeValue(value)); + getClient().invokeCapability("Aspire.Hosting/withEnvironment", reqArgs); + return this; } - /** Excludes the resource from the deployment manifest */ - public IResource excludeFromManifest() { + /** Adds an environment variable with a reference expression */ + public TestDatabaseResource withEnvironmentExpression(String name, ReferenceExpression value) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/excludeFromManifest", reqArgs); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("value", AspireClient.serializeValue(value)); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentExpression", reqArgs); + return this; } - /** Waits for another resource to be ready */ - public IResourceWithWaitSupport waitFor(IResource dependency) { + /** Sets environment variables via callback */ + public TestDatabaseResource withEnvironmentCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitFor", reqArgs); + var callbackId = getClient().registerCallback(args -> { + var obj = (EnvironmentCallbackContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withEnvironmentCallback", reqArgs); + return this; } - /** Waits for another resource with specific behavior */ - public IResourceWithWaitSupport waitForWithBehavior(IResource dependency, WaitBehavior waitBehavior) { + /** Sets environment variables via async callback */ + public TestDatabaseResource withEnvironmentCallbackAsync(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - reqArgs.put("waitBehavior", AspireClient.serializeValue(waitBehavior)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForWithBehavior", reqArgs); + var callbackId = getClient().registerCallback(args -> { + var arg = (EnvironmentCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withEnvironmentCallbackAsync", reqArgs); + return this; } - /** Waits for another resource to start */ - public IResourceWithWaitSupport waitForStart(IResource dependency) { + /** Sets an environment variable from an endpoint reference */ + public TestDatabaseResource withEnvironmentEndpoint(String name, EndpointReference endpointReference) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForStart", reqArgs); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("endpointReference", AspireClient.serializeValue(endpointReference)); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentEndpoint", reqArgs); + return this; } - /** Waits for another resource to start with specific behavior */ - public IResourceWithWaitSupport waitForStartWithBehavior(IResource dependency, WaitBehavior waitBehavior) { + /** Sets an environment variable from a parameter resource */ + public TestDatabaseResource withEnvironmentParameter(String name, ParameterResource parameter) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - reqArgs.put("waitBehavior", AspireClient.serializeValue(waitBehavior)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForStartWithBehavior", reqArgs); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("parameter", AspireClient.serializeValue(parameter)); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentParameter", reqArgs); + return this; } - /** Prevents resource from starting automatically */ - public IResource withExplicitStart() { + /** Sets an environment variable from a connection string resource */ + public TestDatabaseResource withEnvironmentConnectionString(String envVarName, IResourceWithConnectionString resource) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withExplicitStart", reqArgs); + reqArgs.put("envVarName", AspireClient.serializeValue(envVarName)); + reqArgs.put("resource", AspireClient.serializeValue(resource)); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentConnectionString", reqArgs); + return this; } - /** Waits for resource completion */ - public IResourceWithWaitSupport waitForCompletion(IResource dependency, Double exitCode) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - if (exitCode != null) { - reqArgs.put("exitCode", AspireClient.serializeValue(exitCode)); - } - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForCompletion", reqArgs); + public TestDatabaseResource withEnvironmentConnectionString(String envVarName, ResourceBuilderBase resource) { + return withEnvironmentConnectionString(envVarName, new IResourceWithConnectionString(resource.getHandle(), resource.getClient())); } - /** Adds a health check by key */ - public IResource withHealthCheck(String key) { + /** Adds arguments */ + public TestDatabaseResource withArgs(String[] args) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("key", AspireClient.serializeValue(key)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withHealthCheck", reqArgs); + reqArgs.put("args", AspireClient.serializeValue(args)); + getClient().invokeCapability("Aspire.Hosting/withArgs", reqArgs); + return this; } - /** Adds an HTTP health check */ - public IResourceWithEndpoints withHttpHealthCheck(String path, Double statusCode, String endpointName) { + /** Sets command-line arguments via callback */ + public TestDatabaseResource withArgsCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (path != null) { - reqArgs.put("path", AspireClient.serializeValue(path)); - } - if (statusCode != null) { - reqArgs.put("statusCode", AspireClient.serializeValue(statusCode)); - } - if (endpointName != null) { - reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + var callbackId = getClient().registerCallback(args -> { + var obj = (CommandLineArgsCallbackContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withHttpHealthCheck", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withArgsCallback", reqArgs); + return this; } - /** Adds a resource command */ - public IResource withCommand(String name, String displayName, Function executeCommand, CommandOptions commandOptions) { + /** Sets command-line arguments via async callback */ + public TestDatabaseResource withArgsCallbackAsync(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("displayName", AspireClient.serializeValue(displayName)); - if (executeCommand != null) { - reqArgs.put("executeCommand", getClient().registerCallback(executeCommand)); - } - if (commandOptions != null) { - reqArgs.put("commandOptions", AspireClient.serializeValue(commandOptions)); + var callbackId = getClient().registerCallback(args -> { + var arg = (CommandLineArgsCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withCommand", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withArgsCallbackAsync", reqArgs); + return this; } - /** Configures developer certificate trust */ - public IResourceWithEnvironment withDeveloperCertificateTrust(boolean trust) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("trust", AspireClient.serializeValue(trust)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withDeveloperCertificateTrust", reqArgs); + /** Adds a reference to another resource */ + public TestDatabaseResource withReference(IResource source, WithReferenceOptions options) { + var connectionName = options == null ? null : options.getConnectionName(); + var optional = options == null ? null : options.getOptional(); + var name = options == null ? null : options.getName(); + return withReferenceImpl(source, connectionName, optional, name); } - /** Sets the certificate trust scope */ - public IResourceWithEnvironment withCertificateTrustScope(CertificateTrustScope scope) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("scope", AspireClient.serializeValue(scope)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withCertificateTrustScope", reqArgs); + public TestDatabaseResource withReference(ResourceBuilderBase source, WithReferenceOptions options) { + return withReference(new IResource(source.getHandle(), source.getClient()), options); } - /** Configures HTTPS with a developer certificate */ - public IResourceWithEnvironment withHttpsDeveloperCertificate(ParameterResource password) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (password != null) { - reqArgs.put("password", AspireClient.serializeValue(password)); - } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withHttpsDeveloperCertificate", reqArgs); + public TestDatabaseResource withReference(IResource source) { + return withReference(source, null); } - /** Removes HTTPS certificate configuration */ - public IResourceWithEnvironment withoutHttpsCertificate() { + public TestDatabaseResource withReference(ResourceBuilderBase source) { + return withReference(new IResource(source.getHandle(), source.getClient())); + } + + /** Adds a reference to another resource */ + private TestDatabaseResource withReferenceImpl(IResource source, String connectionName, Boolean optional, String name) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withoutHttpsCertificate", reqArgs); + reqArgs.put("source", AspireClient.serializeValue(source)); + if (connectionName != null) { + reqArgs.put("connectionName", AspireClient.serializeValue(connectionName)); + } + if (optional != null) { + reqArgs.put("optional", AspireClient.serializeValue(optional)); + } + if (name != null) { + reqArgs.put("name", AspireClient.serializeValue(name)); + } + getClient().invokeCapability("Aspire.Hosting/withReference", reqArgs); + return this; } - /** Sets the parent relationship */ - public IResource withParentRelationship(IResource parent) { + /** Adds a reference to a URI */ + public TestDatabaseResource withReferenceUri(String name, String uri) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("parent", AspireClient.serializeValue(parent)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withParentRelationship", reqArgs); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("uri", AspireClient.serializeValue(uri)); + getClient().invokeCapability("Aspire.Hosting/withReferenceUri", reqArgs); + return this; } - /** Sets a child relationship */ - public IResource withChildRelationship(IResource child) { + /** Adds a reference to an external service */ + public TestDatabaseResource withReferenceExternalService(ExternalServiceResource externalService) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("child", AspireClient.serializeValue(child)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withChildRelationship", reqArgs); + reqArgs.put("externalService", AspireClient.serializeValue(externalService)); + getClient().invokeCapability("Aspire.Hosting/withReferenceExternalService", reqArgs); + return this; } - /** Sets the icon for the resource */ - public IResource withIconName(String iconName, IconVariant iconVariant) { + /** Adds a reference to an endpoint */ + public TestDatabaseResource withReferenceEndpoint(EndpointReference endpointReference) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("iconName", AspireClient.serializeValue(iconName)); - if (iconVariant != null) { - reqArgs.put("iconVariant", AspireClient.serializeValue(iconVariant)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withIconName", reqArgs); + reqArgs.put("endpointReference", AspireClient.serializeValue(endpointReference)); + getClient().invokeCapability("Aspire.Hosting/withReferenceEndpoint", reqArgs); + return this; } - /** Adds an HTTP health probe to the resource */ - public IResourceWithEndpoints withHttpProbe(ProbeType probeType, String path, Double initialDelaySeconds, Double periodSeconds, Double timeoutSeconds, Double failureThreshold, Double successThreshold, String endpointName) { + /** Adds a network endpoint */ + public TestDatabaseResource withEndpoint(WithEndpointOptions options) { + var port = options == null ? null : options.getPort(); + var targetPort = options == null ? null : options.getTargetPort(); + var scheme = options == null ? null : options.getScheme(); + var name = options == null ? null : options.getName(); + var env = options == null ? null : options.getEnv(); + var isProxied = options == null ? null : options.isProxied(); + var isExternal = options == null ? null : options.isExternal(); + var protocol = options == null ? null : options.getProtocol(); + return withEndpointImpl(port, targetPort, scheme, name, env, isProxied, isExternal, protocol); + } + + public TestDatabaseResource withEndpoint() { + return withEndpoint(null); + } + + /** Adds a network endpoint */ + private TestDatabaseResource withEndpointImpl(Double port, Double targetPort, String scheme, String name, String env, Boolean isProxied, Boolean isExternal, ProtocolType protocol) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("probeType", AspireClient.serializeValue(probeType)); - if (path != null) { - reqArgs.put("path", AspireClient.serializeValue(path)); + if (port != null) { + reqArgs.put("port", AspireClient.serializeValue(port)); } - if (initialDelaySeconds != null) { - reqArgs.put("initialDelaySeconds", AspireClient.serializeValue(initialDelaySeconds)); + if (targetPort != null) { + reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); } - if (periodSeconds != null) { - reqArgs.put("periodSeconds", AspireClient.serializeValue(periodSeconds)); + if (scheme != null) { + reqArgs.put("scheme", AspireClient.serializeValue(scheme)); } - if (timeoutSeconds != null) { - reqArgs.put("timeoutSeconds", AspireClient.serializeValue(timeoutSeconds)); + if (name != null) { + reqArgs.put("name", AspireClient.serializeValue(name)); } - if (failureThreshold != null) { - reqArgs.put("failureThreshold", AspireClient.serializeValue(failureThreshold)); + if (env != null) { + reqArgs.put("env", AspireClient.serializeValue(env)); } - if (successThreshold != null) { - reqArgs.put("successThreshold", AspireClient.serializeValue(successThreshold)); + if (isProxied != null) { + reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); } - if (endpointName != null) { - reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + if (isExternal != null) { + reqArgs.put("isExternal", AspireClient.serializeValue(isExternal)); + } + if (protocol != null) { + reqArgs.put("protocol", AspireClient.serializeValue(protocol)); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withHttpProbe", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withEndpoint", reqArgs); + return this; } - /** Excludes the resource from MCP server exposure */ - public IResource excludeFromMcp() { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/excludeFromMcp", reqArgs); + /** Adds an HTTP endpoint */ + public TestDatabaseResource withHttpEndpoint(WithHttpEndpointOptions options) { + var port = options == null ? null : options.getPort(); + var targetPort = options == null ? null : options.getTargetPort(); + var name = options == null ? null : options.getName(); + var env = options == null ? null : options.getEnv(); + var isProxied = options == null ? null : options.isProxied(); + return withHttpEndpointImpl(port, targetPort, name, env, isProxied); } - /** Sets the remote image name for publishing */ - public IComputeResource withRemoteImageName(String remoteImageName) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("remoteImageName", AspireClient.serializeValue(remoteImageName)); - return (IComputeResource) getClient().invokeCapability("Aspire.Hosting/withRemoteImageName", reqArgs); + public TestDatabaseResource withHttpEndpoint() { + return withHttpEndpoint(null); } - /** Sets the remote image tag for publishing */ - public IComputeResource withRemoteImageTag(String remoteImageTag) { + /** Adds an HTTP endpoint */ + private TestDatabaseResource withHttpEndpointImpl(Double port, Double targetPort, String name, String env, Boolean isProxied) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("remoteImageTag", AspireClient.serializeValue(remoteImageTag)); - return (IComputeResource) getClient().invokeCapability("Aspire.Hosting/withRemoteImageTag", reqArgs); + if (port != null) { + reqArgs.put("port", AspireClient.serializeValue(port)); + } + if (targetPort != null) { + reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); + } + if (name != null) { + reqArgs.put("name", AspireClient.serializeValue(name)); + } + if (env != null) { + reqArgs.put("env", AspireClient.serializeValue(env)); + } + if (isProxied != null) { + reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); + } + getClient().invokeCapability("Aspire.Hosting/withHttpEndpoint", reqArgs); + return this; } - /** Adds a pipeline step to the resource */ - public IResource withPipelineStepFactory(String stepName, Function callback, String[] dependsOn, String[] requiredBy, String[] tags, String description) { + /** Adds an HTTPS endpoint */ + public TestDatabaseResource withHttpsEndpoint(WithHttpsEndpointOptions options) { + var port = options == null ? null : options.getPort(); + var targetPort = options == null ? null : options.getTargetPort(); + var name = options == null ? null : options.getName(); + var env = options == null ? null : options.getEnv(); + var isProxied = options == null ? null : options.isProxied(); + return withHttpsEndpointImpl(port, targetPort, name, env, isProxied); + } + + public TestDatabaseResource withHttpsEndpoint() { + return withHttpsEndpoint(null); + } + + /** Adds an HTTPS endpoint */ + private TestDatabaseResource withHttpsEndpointImpl(Double port, Double targetPort, String name, String env, Boolean isProxied) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("stepName", AspireClient.serializeValue(stepName)); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + if (port != null) { + reqArgs.put("port", AspireClient.serializeValue(port)); } - if (dependsOn != null) { - reqArgs.put("dependsOn", AspireClient.serializeValue(dependsOn)); + if (targetPort != null) { + reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); } - if (requiredBy != null) { - reqArgs.put("requiredBy", AspireClient.serializeValue(requiredBy)); + if (name != null) { + reqArgs.put("name", AspireClient.serializeValue(name)); } - if (tags != null) { - reqArgs.put("tags", AspireClient.serializeValue(tags)); + if (env != null) { + reqArgs.put("env", AspireClient.serializeValue(env)); } - if (description != null) { - reqArgs.put("description", AspireClient.serializeValue(description)); + if (isProxied != null) { + reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withPipelineStepFactory", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withHttpsEndpoint", reqArgs); + return this; } - /** Configures pipeline step dependencies via an async callback */ - public IResource withPipelineConfigurationAsync(Function callback) { + /** Makes HTTP endpoints externally accessible */ + public TestDatabaseResource withExternalHttpEndpoints() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withPipelineConfigurationAsync", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withExternalHttpEndpoints", reqArgs); + return this; } - /** Configures pipeline step dependencies via a callback */ - public IResource withPipelineConfiguration(Function callback) { + /** Gets an endpoint reference */ + public EndpointReference getEndpoint(String name) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withPipelineConfiguration", reqArgs); + reqArgs.put("name", AspireClient.serializeValue(name)); + return (EndpointReference) getClient().invokeCapability("Aspire.Hosting/getEndpoint", reqArgs); } - /** Gets the resource name */ - public String getResourceName() { + /** Configures resource for HTTP/2 */ + public TestDatabaseResource asHttp2Service() { Map reqArgs = new HashMap<>(); - reqArgs.put("resource", AspireClient.serializeValue(getHandle())); - return (String) getClient().invokeCapability("Aspire.Hosting/getResourceName", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + getClient().invokeCapability("Aspire.Hosting/asHttp2Service", reqArgs); + return this; } - /** Subscribes to the BeforeResourceStarted event */ - public IResource onBeforeResourceStarted(Function callback) { + /** Customizes displayed URLs via callback */ + public TestDatabaseResource withUrlsCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var obj = (ResourceUrlsCallbackContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onBeforeResourceStarted", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrlsCallback", reqArgs); + return this; } - /** Subscribes to the ResourceStopped event */ - public IResource onResourceStopped(Function callback) { + /** Customizes displayed URLs via async callback */ + public TestDatabaseResource withUrlsCallbackAsync(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceUrlsCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onResourceStopped", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrlsCallbackAsync", reqArgs); + return this; } - /** Subscribes to the InitializeResource event */ - public IResource onInitializeResource(Function callback) { + public TestDatabaseResource withUrl(String url) { + return withUrl(url, null); + } + + /** Adds or modifies displayed URLs */ + public TestDatabaseResource withUrl(String url, String displayText) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + reqArgs.put("url", AspireClient.serializeValue(url)); + if (displayText != null) { + reqArgs.put("displayText", AspireClient.serializeValue(displayText)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onInitializeResource", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrl", reqArgs); + return this; } - /** Subscribes to the ResourceEndpointsAllocated event */ - public IResourceWithEndpoints onResourceEndpointsAllocated(Function callback) { + public TestDatabaseResource withUrlExpression(ReferenceExpression url) { + return withUrlExpression(url, null); + } + + /** Adds a URL using a reference expression */ + public TestDatabaseResource withUrlExpression(ReferenceExpression url, String displayText) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + reqArgs.put("url", AspireClient.serializeValue(url)); + if (displayText != null) { + reqArgs.put("displayText", AspireClient.serializeValue(displayText)); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/onResourceEndpointsAllocated", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrlExpression", reqArgs); + return this; } - /** Subscribes to the ResourceReady event */ - public IResource onResourceReady(Function callback) { + /** Customizes the URL for a specific endpoint via callback */ + public TestDatabaseResource withUrlForEndpoint(String endpointName, AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + var callbackId = getClient().registerCallback(args -> { + var obj = (ResourceUrlAnnotation) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onResourceReady", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrlForEndpoint", reqArgs); + return this; } - /** Adds an optional string parameter */ - public IResource withOptionalString(String value, Boolean enabled) { + /** Adds a URL for a specific endpoint via factory callback */ + public TestDatabaseResource withUrlForEndpointFactory(String endpointName, AspireFunc1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (value != null) { - reqArgs.put("value", AspireClient.serializeValue(value)); - } - if (enabled != null) { - reqArgs.put("enabled", AspireClient.serializeValue(enabled)); + reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + var callbackId = getClient().registerCallback(args -> { + var arg = (EndpointReference) args[0]; + return AspireClient.awaitValue(callback.invoke(arg)); + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalString", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrlForEndpointFactory", reqArgs); + return this; } - /** Configures the resource with a DTO */ - public IResource withConfig(TestConfigDto config) { + /** Excludes the resource from the deployment manifest */ + public TestDatabaseResource excludeFromManifest() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("config", AspireClient.serializeValue(config)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConfig", reqArgs); + getClient().invokeCapability("Aspire.Hosting/excludeFromManifest", reqArgs); + return this; } - /** Configures environment with callback (test version) */ - public IResourceWithEnvironment testWithEnvironmentCallback(Function callback) { + /** Waits for another resource to be ready */ + public TestDatabaseResource waitFor(IResource dependency) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWithEnvironmentCallback", reqArgs); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + getClient().invokeCapability("Aspire.Hosting/waitFor", reqArgs); + return this; } - /** Sets the created timestamp */ - public IResource withCreatedAt(String createdAt) { + public TestDatabaseResource waitFor(ResourceBuilderBase dependency) { + return waitFor(new IResource(dependency.getHandle(), dependency.getClient())); + } + + /** Waits for another resource with specific behavior */ + public TestDatabaseResource waitForWithBehavior(IResource dependency, WaitBehavior waitBehavior) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("createdAt", AspireClient.serializeValue(createdAt)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCreatedAt", reqArgs); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + reqArgs.put("waitBehavior", AspireClient.serializeValue(waitBehavior)); + getClient().invokeCapability("Aspire.Hosting/waitForWithBehavior", reqArgs); + return this; } - /** Sets the modified timestamp */ - public IResource withModifiedAt(String modifiedAt) { + public TestDatabaseResource waitForWithBehavior(ResourceBuilderBase dependency, WaitBehavior waitBehavior) { + return waitForWithBehavior(new IResource(dependency.getHandle(), dependency.getClient()), waitBehavior); + } + + /** Waits for another resource to start */ + public TestDatabaseResource waitForStart(IResource dependency) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("modifiedAt", AspireClient.serializeValue(modifiedAt)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withModifiedAt", reqArgs); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + getClient().invokeCapability("Aspire.Hosting/waitForStart", reqArgs); + return this; } - /** Sets the correlation ID */ - public IResource withCorrelationId(String correlationId) { + public TestDatabaseResource waitForStart(ResourceBuilderBase dependency) { + return waitForStart(new IResource(dependency.getHandle(), dependency.getClient())); + } + + /** Waits for another resource to start with specific behavior */ + public TestDatabaseResource waitForStartWithBehavior(IResource dependency, WaitBehavior waitBehavior) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("correlationId", AspireClient.serializeValue(correlationId)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCorrelationId", reqArgs); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + reqArgs.put("waitBehavior", AspireClient.serializeValue(waitBehavior)); + getClient().invokeCapability("Aspire.Hosting/waitForStartWithBehavior", reqArgs); + return this; } - /** Configures with optional callback */ - public IResource withOptionalCallback(Function callback) { + public TestDatabaseResource waitForStartWithBehavior(ResourceBuilderBase dependency, WaitBehavior waitBehavior) { + return waitForStartWithBehavior(new IResource(dependency.getHandle(), dependency.getClient()), waitBehavior); + } + + /** Prevents resource from starting automatically */ + public TestDatabaseResource withExplicitStart() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalCallback", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withExplicitStart", reqArgs); + return this; } - /** Sets the resource status */ - public IResource withStatus(TestResourceStatus status) { + public TestDatabaseResource waitForCompletion(IResource dependency) { + return waitForCompletion(dependency, null); + } + + public TestDatabaseResource waitForCompletion(ResourceBuilderBase dependency) { + return waitForCompletion(new IResource(dependency.getHandle(), dependency.getClient())); + } + + /** Waits for resource completion */ + public TestDatabaseResource waitForCompletion(IResource dependency, Double exitCode) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("status", AspireClient.serializeValue(status)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withStatus", reqArgs); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + if (exitCode != null) { + reqArgs.put("exitCode", AspireClient.serializeValue(exitCode)); + } + getClient().invokeCapability("Aspire.Hosting/waitForCompletion", reqArgs); + return this; } - /** Configures with nested DTO */ - public IResource withNestedConfig(TestNestedDto config) { + public TestDatabaseResource waitForCompletion(ResourceBuilderBase dependency, Double exitCode) { + return waitForCompletion(new IResource(dependency.getHandle(), dependency.getClient()), exitCode); + } + + /** Adds a health check by key */ + public TestDatabaseResource withHealthCheck(String key) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("config", AspireClient.serializeValue(config)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withNestedConfig", reqArgs); + reqArgs.put("key", AspireClient.serializeValue(key)); + getClient().invokeCapability("Aspire.Hosting/withHealthCheck", reqArgs); + return this; } - /** Adds validation callback */ - public IResource withValidator(Function validator) { + /** Adds an HTTP health check */ + public TestDatabaseResource withHttpHealthCheck(WithHttpHealthCheckOptions options) { + var path = options == null ? null : options.getPath(); + var statusCode = options == null ? null : options.getStatusCode(); + var endpointName = options == null ? null : options.getEndpointName(); + return withHttpHealthCheckImpl(path, statusCode, endpointName); + } + + public TestDatabaseResource withHttpHealthCheck() { + return withHttpHealthCheck(null); + } + + /** Adds an HTTP health check */ + private TestDatabaseResource withHttpHealthCheckImpl(String path, Double statusCode, String endpointName) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (validator != null) { - reqArgs.put("validator", getClient().registerCallback(validator)); + if (path != null) { + reqArgs.put("path", AspireClient.serializeValue(path)); + } + if (statusCode != null) { + reqArgs.put("statusCode", AspireClient.serializeValue(statusCode)); + } + if (endpointName != null) { + reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withValidator", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withHttpHealthCheck", reqArgs); + return this; } - /** Waits for another resource (test version) */ - public IResource testWaitFor(IResource dependency) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWaitFor", reqArgs); + public TestDatabaseResource withCommand(String name, String displayName, AspireFunc1 executeCommand) { + return withCommand(name, displayName, executeCommand, null); } - /** Adds a dependency on another resource */ - public IResource withDependency(IResourceWithConnectionString dependency) { + /** Adds a resource command */ + public TestDatabaseResource withCommand(String name, String displayName, AspireFunc1 executeCommand, CommandOptions commandOptions) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDependency", reqArgs); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("displayName", AspireClient.serializeValue(displayName)); + var executeCommandId = getClient().registerCallback(args -> { + var arg = (ExecuteCommandContext) args[0]; + return AspireClient.awaitValue(executeCommand.invoke(arg)); + }); + if (executeCommandId != null) { + reqArgs.put("executeCommand", executeCommandId); + } + if (commandOptions != null) { + reqArgs.put("commandOptions", AspireClient.serializeValue(commandOptions)); + } + getClient().invokeCapability("Aspire.Hosting/withCommand", reqArgs); + return this; } - /** Sets the endpoints */ - public IResource withEndpoints(String[] endpoints) { + /** Configures developer certificate trust */ + public TestDatabaseResource withDeveloperCertificateTrust(boolean trust) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("endpoints", AspireClient.serializeValue(endpoints)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEndpoints", reqArgs); + reqArgs.put("trust", AspireClient.serializeValue(trust)); + getClient().invokeCapability("Aspire.Hosting/withDeveloperCertificateTrust", reqArgs); + return this; } - /** Sets environment variables */ - public IResourceWithEnvironment withEnvironmentVariables(Map variables) { + /** Sets the certificate trust scope */ + public TestDatabaseResource withCertificateTrustScope(CertificateTrustScope scope) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("variables", AspireClient.serializeValue(variables)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEnvironmentVariables", reqArgs); + reqArgs.put("scope", AspireClient.serializeValue(scope)); + getClient().invokeCapability("Aspire.Hosting/withCertificateTrustScope", reqArgs); + return this; } - /** Performs a cancellable operation */ - public IResource withCancellableOperation(Function operation) { + public TestDatabaseResource withHttpsDeveloperCertificate() { + return withHttpsDeveloperCertificate(null); + } + + /** Configures HTTPS with a developer certificate */ + public TestDatabaseResource withHttpsDeveloperCertificate(ParameterResource password) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (operation != null) { - reqArgs.put("operation", getClient().registerCallback(operation)); + if (password != null) { + reqArgs.put("password", AspireClient.serializeValue(password)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCancellableOperation", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withHttpsDeveloperCertificate", reqArgs); + return this; } -} - -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions. */ -class ProjectResourceOptions extends HandleWrapperBase { - ProjectResourceOptions(Handle handle, AspireClient client) { - super(handle, client); + /** Removes HTTPS certificate configuration */ + public TestDatabaseResource withoutHttpsCertificate() { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + getClient().invokeCapability("Aspire.Hosting/withoutHttpsCertificate", reqArgs); + return this; } - /** Gets the LaunchProfileName property */ - public String launchProfileName() { + /** Sets the parent relationship */ + public TestDatabaseResource withParentRelationship(IResource parent) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (String) getClient().invokeCapability("Aspire.Hosting/ProjectResourceOptions.launchProfileName", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("parent", AspireClient.serializeValue(parent)); + getClient().invokeCapability("Aspire.Hosting/withParentRelationship", reqArgs); + return this; } - /** Sets the LaunchProfileName property */ - public ProjectResourceOptions setLaunchProfileName(String value) { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (ProjectResourceOptions) getClient().invokeCapability("Aspire.Hosting/ProjectResourceOptions.setLaunchProfileName", reqArgs); + public TestDatabaseResource withParentRelationship(ResourceBuilderBase parent) { + return withParentRelationship(new IResource(parent.getHandle(), parent.getClient())); } - /** Gets the ExcludeLaunchProfile property */ - public boolean excludeLaunchProfile() { + /** Sets a child relationship */ + public TestDatabaseResource withChildRelationship(IResource child) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (boolean) getClient().invokeCapability("Aspire.Hosting/ProjectResourceOptions.excludeLaunchProfile", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("child", AspireClient.serializeValue(child)); + getClient().invokeCapability("Aspire.Hosting/withChildRelationship", reqArgs); + return this; } - /** Sets the ExcludeLaunchProfile property */ - public ProjectResourceOptions setExcludeLaunchProfile(boolean value) { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (ProjectResourceOptions) getClient().invokeCapability("Aspire.Hosting/ProjectResourceOptions.setExcludeLaunchProfile", reqArgs); + public TestDatabaseResource withChildRelationship(ResourceBuilderBase child) { + return withChildRelationship(new IResource(child.getHandle(), child.getClient())); } - /** Gets the ExcludeKestrelEndpoints property */ - public boolean excludeKestrelEndpoints() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (boolean) getClient().invokeCapability("Aspire.Hosting/ProjectResourceOptions.excludeKestrelEndpoints", reqArgs); + public TestDatabaseResource withIconName(String iconName) { + return withIconName(iconName, null); } - /** Sets the ExcludeKestrelEndpoints property */ - public ProjectResourceOptions setExcludeKestrelEndpoints(boolean value) { + /** Sets the icon for the resource */ + public TestDatabaseResource withIconName(String iconName, IconVariant iconVariant) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (ProjectResourceOptions) getClient().invokeCapability("Aspire.Hosting/ProjectResourceOptions.setExcludeKestrelEndpoints", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("iconName", AspireClient.serializeValue(iconName)); + if (iconVariant != null) { + reqArgs.put("iconVariant", AspireClient.serializeValue(iconVariant)); + } + getClient().invokeCapability("Aspire.Hosting/withIconName", reqArgs); + return this; } -} + /** Adds an HTTP health probe to the resource */ + public TestDatabaseResource withHttpProbe(ProbeType probeType, WithHttpProbeOptions options) { + var path = options == null ? null : options.getPath(); + var initialDelaySeconds = options == null ? null : options.getInitialDelaySeconds(); + var periodSeconds = options == null ? null : options.getPeriodSeconds(); + var timeoutSeconds = options == null ? null : options.getTimeoutSeconds(); + var failureThreshold = options == null ? null : options.getFailureThreshold(); + var successThreshold = options == null ? null : options.getSuccessThreshold(); + var endpointName = options == null ? null : options.getEndpointName(); + return withHttpProbeImpl(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName); + } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder. */ -class ReferenceExpressionBuilder extends HandleWrapperBase { - ReferenceExpressionBuilder(Handle handle, AspireClient client) { - super(handle, client); + public TestDatabaseResource withHttpProbe(ProbeType probeType) { + return withHttpProbe(probeType, null); } - /** Gets the IsEmpty property */ - public boolean isEmpty() { + /** Adds an HTTP health probe to the resource */ + private TestDatabaseResource withHttpProbeImpl(ProbeType probeType, String path, Double initialDelaySeconds, Double periodSeconds, Double timeoutSeconds, Double failureThreshold, Double successThreshold, String endpointName) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (boolean) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ReferenceExpressionBuilder.isEmpty", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("probeType", AspireClient.serializeValue(probeType)); + if (path != null) { + reqArgs.put("path", AspireClient.serializeValue(path)); + } + if (initialDelaySeconds != null) { + reqArgs.put("initialDelaySeconds", AspireClient.serializeValue(initialDelaySeconds)); + } + if (periodSeconds != null) { + reqArgs.put("periodSeconds", AspireClient.serializeValue(periodSeconds)); + } + if (timeoutSeconds != null) { + reqArgs.put("timeoutSeconds", AspireClient.serializeValue(timeoutSeconds)); + } + if (failureThreshold != null) { + reqArgs.put("failureThreshold", AspireClient.serializeValue(failureThreshold)); + } + if (successThreshold != null) { + reqArgs.put("successThreshold", AspireClient.serializeValue(successThreshold)); + } + if (endpointName != null) { + reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + } + getClient().invokeCapability("Aspire.Hosting/withHttpProbe", reqArgs); + return this; } - /** Appends a literal string to the reference expression */ - public void appendLiteral(String value) { + /** Excludes the resource from MCP server exposure */ + public TestDatabaseResource excludeFromMcp() { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - reqArgs.put("value", AspireClient.serializeValue(value)); - getClient().invokeCapability("Aspire.Hosting.ApplicationModel/appendLiteral", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + getClient().invokeCapability("Aspire.Hosting/excludeFromMcp", reqArgs); + return this; } - /** Appends a formatted string value to the reference expression */ - public void appendFormatted(String value, String format) { + /** Sets the remote image name for publishing */ + public TestDatabaseResource withRemoteImageName(String remoteImageName) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - reqArgs.put("value", AspireClient.serializeValue(value)); - if (format != null) { - reqArgs.put("format", AspireClient.serializeValue(format)); - } - getClient().invokeCapability("Aspire.Hosting.ApplicationModel/appendFormatted", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("remoteImageName", AspireClient.serializeValue(remoteImageName)); + getClient().invokeCapability("Aspire.Hosting/withRemoteImageName", reqArgs); + return this; } - /** Appends a value provider to the reference expression */ - public void appendValueProvider(Object valueProvider, String format) { + /** Sets the remote image tag for publishing */ + public TestDatabaseResource withRemoteImageTag(String remoteImageTag) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - reqArgs.put("valueProvider", AspireClient.serializeValue(valueProvider)); - if (format != null) { - reqArgs.put("format", AspireClient.serializeValue(format)); - } - getClient().invokeCapability("Aspire.Hosting.ApplicationModel/appendValueProvider", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("remoteImageTag", AspireClient.serializeValue(remoteImageTag)); + getClient().invokeCapability("Aspire.Hosting/withRemoteImageTag", reqArgs); + return this; } - /** Builds the reference expression */ - public ReferenceExpression build() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (ReferenceExpression) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/build", reqArgs); + /** Adds a pipeline step to the resource */ + public TestDatabaseResource withPipelineStepFactory(String stepName, AspireAction1 callback, WithPipelineStepFactoryOptions options) { + var dependsOn = options == null ? null : options.getDependsOn(); + var requiredBy = options == null ? null : options.getRequiredBy(); + var tags = options == null ? null : options.getTags(); + var description = options == null ? null : options.getDescription(); + return withPipelineStepFactoryImpl(stepName, callback, dependsOn, requiredBy, tags, description); } -} + public TestDatabaseResource withPipelineStepFactory(String stepName, AspireAction1 callback) { + return withPipelineStepFactory(stepName, callback, null); + } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent. */ -class ResourceEndpointsAllocatedEvent extends HandleWrapperBase { - ResourceEndpointsAllocatedEvent(Handle handle, AspireClient client) { - super(handle, client); + /** Adds a pipeline step to the resource */ + private TestDatabaseResource withPipelineStepFactoryImpl(String stepName, AspireAction1 callback, String[] dependsOn, String[] requiredBy, String[] tags, String description) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("stepName", AspireClient.serializeValue(stepName)); + var callbackId = getClient().registerCallback(args -> { + var arg = (PipelineStepContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + if (dependsOn != null) { + reqArgs.put("dependsOn", AspireClient.serializeValue(dependsOn)); + } + if (requiredBy != null) { + reqArgs.put("requiredBy", AspireClient.serializeValue(requiredBy)); + } + if (tags != null) { + reqArgs.put("tags", AspireClient.serializeValue(tags)); + } + if (description != null) { + reqArgs.put("description", AspireClient.serializeValue(description)); + } + getClient().invokeCapability("Aspire.Hosting/withPipelineStepFactory", reqArgs); + return this; } - /** Gets the Resource property */ - public IResource resource() { + /** Configures pipeline step dependencies via an async callback */ + public TestDatabaseResource withPipelineConfigurationAsync(AspireAction1 callback) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.resource", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (PipelineConfigurationContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withPipelineConfigurationAsync", reqArgs); + return this; } - /** Gets the Services property */ - public IServiceProvider services() { + /** Configures pipeline step dependencies via a callback */ + public TestDatabaseResource withPipelineConfiguration(AspireAction1 callback) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (IServiceProvider) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ResourceEndpointsAllocatedEvent.services", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var obj = (PipelineConfigurationContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withPipelineConfiguration", reqArgs); + return this; } -} + /** Adds a volume */ + public TestDatabaseResource withVolume(String target, WithVolumeOptions options) { + var name = options == null ? null : options.getName(); + var isReadOnly = options == null ? null : options.isReadOnly(); + return withVolumeImpl(target, name, isReadOnly); + } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService. */ -class ResourceLoggerService extends HandleWrapperBase { - ResourceLoggerService(Handle handle, AspireClient client) { - super(handle, client); + public TestDatabaseResource withVolume(String target) { + return withVolume(target, null); } - /** Completes the log stream for a resource */ - public void completeLog(IResource resource) { + /** Adds a volume */ + private TestDatabaseResource withVolumeImpl(String target, String name, Boolean isReadOnly) { Map reqArgs = new HashMap<>(); - reqArgs.put("loggerService", AspireClient.serializeValue(getHandle())); - reqArgs.put("resource", AspireClient.serializeValue(resource)); - getClient().invokeCapability("Aspire.Hosting/completeLog", reqArgs); + reqArgs.put("resource", AspireClient.serializeValue(getHandle())); + reqArgs.put("target", AspireClient.serializeValue(target)); + if (name != null) { + reqArgs.put("name", AspireClient.serializeValue(name)); + } + if (isReadOnly != null) { + reqArgs.put("isReadOnly", AspireClient.serializeValue(isReadOnly)); + } + getClient().invokeCapability("Aspire.Hosting/withVolume", reqArgs); + return this; } - /** Completes the log stream by resource name */ - public void completeLogByName(String resourceName) { + /** Gets the resource name */ + public String getResourceName() { Map reqArgs = new HashMap<>(); - reqArgs.put("loggerService", AspireClient.serializeValue(getHandle())); - reqArgs.put("resourceName", AspireClient.serializeValue(resourceName)); - getClient().invokeCapability("Aspire.Hosting/completeLogByName", reqArgs); + reqArgs.put("resource", AspireClient.serializeValue(getHandle())); + return (String) getClient().invokeCapability("Aspire.Hosting/getResourceName", reqArgs); } -} - -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService. */ -class ResourceNotificationService extends HandleWrapperBase { - ResourceNotificationService(Handle handle, AspireClient client) { - super(handle, client); + /** Subscribes to the BeforeResourceStarted event */ + public TestDatabaseResource onBeforeResourceStarted(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (BeforeResourceStartedEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onBeforeResourceStarted", reqArgs); + return this; } - /** Waits for a resource to reach a specified state */ - public void waitForResourceState(String resourceName, String targetState) { + /** Subscribes to the ResourceStopped event */ + public TestDatabaseResource onResourceStopped(AspireAction1 callback) { Map reqArgs = new HashMap<>(); - reqArgs.put("notificationService", AspireClient.serializeValue(getHandle())); - reqArgs.put("resourceName", AspireClient.serializeValue(resourceName)); - if (targetState != null) { - reqArgs.put("targetState", AspireClient.serializeValue(targetState)); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceStoppedEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - getClient().invokeCapability("Aspire.Hosting/waitForResourceState", reqArgs); + getClient().invokeCapability("Aspire.Hosting/onResourceStopped", reqArgs); + return this; } - /** Waits for a resource to reach one of the specified states */ - public String waitForResourceStates(String resourceName, String[] targetStates) { + /** Subscribes to the InitializeResource event */ + public TestDatabaseResource onInitializeResource(AspireAction1 callback) { Map reqArgs = new HashMap<>(); - reqArgs.put("notificationService", AspireClient.serializeValue(getHandle())); - reqArgs.put("resourceName", AspireClient.serializeValue(resourceName)); - reqArgs.put("targetStates", AspireClient.serializeValue(targetStates)); - return (String) getClient().invokeCapability("Aspire.Hosting/waitForResourceStates", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (InitializeResourceEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onInitializeResource", reqArgs); + return this; } - /** Waits for a resource to become healthy */ - public ResourceEventDto waitForResourceHealthy(String resourceName) { + /** Subscribes to the ResourceEndpointsAllocated event */ + public TestDatabaseResource onResourceEndpointsAllocated(AspireAction1 callback) { Map reqArgs = new HashMap<>(); - reqArgs.put("notificationService", AspireClient.serializeValue(getHandle())); - reqArgs.put("resourceName", AspireClient.serializeValue(resourceName)); - return (ResourceEventDto) getClient().invokeCapability("Aspire.Hosting/waitForResourceHealthy", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceEndpointsAllocatedEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onResourceEndpointsAllocated", reqArgs); + return this; } - /** Waits for all dependencies of a resource to be ready */ - public void waitForDependencies(IResource resource) { + /** Subscribes to the ResourceReady event */ + public TestDatabaseResource onResourceReady(AspireAction1 callback) { Map reqArgs = new HashMap<>(); - reqArgs.put("notificationService", AspireClient.serializeValue(getHandle())); - reqArgs.put("resource", AspireClient.serializeValue(resource)); - getClient().invokeCapability("Aspire.Hosting/waitForDependencies", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceReadyEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onResourceReady", reqArgs); + return this; } - /** Tries to get the current state of a resource */ - public ResourceEventDto tryGetResourceState(String resourceName) { - Map reqArgs = new HashMap<>(); - reqArgs.put("notificationService", AspireClient.serializeValue(getHandle())); - reqArgs.put("resourceName", AspireClient.serializeValue(resourceName)); - return (ResourceEventDto) getClient().invokeCapability("Aspire.Hosting/tryGetResourceState", reqArgs); + /** Adds an optional string parameter */ + public TestDatabaseResource withOptionalString(WithOptionalStringOptions options) { + var value = options == null ? null : options.getValue(); + var enabled = options == null ? null : options.getEnabled(); + return withOptionalStringImpl(value, enabled); } - /** Publishes an update for a resource's state */ - public void publishResourceUpdate(IResource resource, String state, String stateStyle) { + public TestDatabaseResource withOptionalString() { + return withOptionalString(null); + } + + /** Adds an optional string parameter */ + private TestDatabaseResource withOptionalStringImpl(String value, Boolean enabled) { Map reqArgs = new HashMap<>(); - reqArgs.put("notificationService", AspireClient.serializeValue(getHandle())); - reqArgs.put("resource", AspireClient.serializeValue(resource)); - if (state != null) { - reqArgs.put("state", AspireClient.serializeValue(state)); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + if (value != null) { + reqArgs.put("value", AspireClient.serializeValue(value)); } - if (stateStyle != null) { - reqArgs.put("stateStyle", AspireClient.serializeValue(stateStyle)); + if (enabled != null) { + reqArgs.put("enabled", AspireClient.serializeValue(enabled)); } - getClient().invokeCapability("Aspire.Hosting/publishResourceUpdate", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalString", reqArgs); + return this; } -} + /** Configures the resource with a DTO */ + public TestDatabaseResource withConfig(TestConfigDto config) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("config", AspireClient.serializeValue(config)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConfig", reqArgs); + return this; + } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceReadyEvent. */ -class ResourceReadyEvent extends HandleWrapperBase { - ResourceReadyEvent(Handle handle, AspireClient client) { - super(handle, client); + /** Configures environment with callback (test version) */ + public TestDatabaseResource testWithEnvironmentCallback(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (TestEnvironmentContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWithEnvironmentCallback", reqArgs); + return this; } - /** Gets the Resource property */ - public IResource resource() { + /** Sets the created timestamp */ + public TestDatabaseResource withCreatedAt(String createdAt) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ResourceReadyEvent.resource", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("createdAt", AspireClient.serializeValue(createdAt)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCreatedAt", reqArgs); + return this; } - /** Gets the Services property */ - public IServiceProvider services() { + /** Sets the modified timestamp */ + public TestDatabaseResource withModifiedAt(String modifiedAt) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (IServiceProvider) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ResourceReadyEvent.services", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("modifiedAt", AspireClient.serializeValue(modifiedAt)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withModifiedAt", reqArgs); + return this; } -} + /** Sets the correlation ID */ + public TestDatabaseResource withCorrelationId(String correlationId) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("correlationId", AspireClient.serializeValue(correlationId)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCorrelationId", reqArgs); + return this; + } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceStoppedEvent. */ -class ResourceStoppedEvent extends HandleWrapperBase { - ResourceStoppedEvent(Handle handle, AspireClient client) { - super(handle, client); + public TestDatabaseResource withOptionalCallback() { + return withOptionalCallback(null); } - /** Gets the Resource property */ - public IResource resource() { + /** Configures with optional callback */ + public TestDatabaseResource withOptionalCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.resource", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = callback == null ? null : getClient().registerCallback(args -> { + var arg = (TestCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalCallback", reqArgs); + return this; } - /** Gets the Services property */ - public IServiceProvider services() { + /** Sets the resource status */ + public TestDatabaseResource withStatus(TestResourceStatus status) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (IServiceProvider) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ResourceStoppedEvent.services", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("status", AspireClient.serializeValue(status)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withStatus", reqArgs); + return this; } -} + /** Configures with nested DTO */ + public TestDatabaseResource withNestedConfig(TestNestedDto config) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("config", AspireClient.serializeValue(config)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withNestedConfig", reqArgs); + return this; + } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext. */ -class ResourceUrlsCallbackContext extends HandleWrapperBase { - ResourceUrlsCallbackContext(Handle handle, AspireClient client) { - super(handle, client); + /** Adds validation callback */ + public TestDatabaseResource withValidator(AspireFunc1 validator) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var validatorId = getClient().registerCallback(args -> { + var arg = (TestResourceContext) args[0]; + return AspireClient.awaitValue(validator.invoke(arg)); + }); + if (validatorId != null) { + reqArgs.put("validator", validatorId); + } + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withValidator", reqArgs); + return this; } - /** Gets the Resource property */ - public IResource resource() { + /** Waits for another resource (test version) */ + public TestDatabaseResource testWaitFor(IResource dependency) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.resource", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWaitFor", reqArgs); + return this; } - /** Gets the Urls property */ - private AspireList urlsField; - public AspireList urls() { - if (urlsField == null) { - urlsField = new AspireList<>(getHandle(), getClient(), "Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.urls"); - } - return urlsField; + public TestDatabaseResource testWaitFor(ResourceBuilderBase dependency) { + return testWaitFor(new IResource(dependency.getHandle(), dependency.getClient())); } - /** Gets the CancellationToken property */ - public CancellationToken cancellationToken() { + /** Adds a dependency on another resource */ + public TestDatabaseResource withDependency(IResourceWithConnectionString dependency) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (CancellationToken) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.cancellationToken", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDependency", reqArgs); + return this; } - /** Gets the Logger property */ - public ILogger logger() { + public TestDatabaseResource withDependency(ResourceBuilderBase dependency) { + return withDependency(new IResourceWithConnectionString(dependency.getHandle(), dependency.getClient())); + } + + /** Sets the endpoints */ + public TestDatabaseResource withEndpoints(String[] endpoints) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (ILogger) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.logger", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("endpoints", AspireClient.serializeValue(endpoints)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEndpoints", reqArgs); + return this; } - /** Sets the Logger property */ - public ResourceUrlsCallbackContext setLogger(ILogger value) { + /** Sets environment variables */ + public TestDatabaseResource withEnvironmentVariables(Map variables) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (ResourceUrlsCallbackContext) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.setLogger", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("variables", AspireClient.serializeValue(variables)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEnvironmentVariables", reqArgs); + return this; } - /** Gets the ExecutionContext property */ - public DistributedApplicationExecutionContext executionContext() { + /** Performs a cancellable operation */ + public TestDatabaseResource withCancellableOperation(AspireAction1 operation) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (DistributedApplicationExecutionContext) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/ResourceUrlsCallbackContext.executionContext", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var operationId = getClient().registerCallback(args -> { + var arg = CancellationToken.fromValue(args[0]); + operation.invoke(arg); + return null; + }); + if (operationId != null) { + reqArgs.put("operation", operationId); + } + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCancellableOperation", reqArgs); + return this; } } -/** Wrapper for Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestCallbackContext. */ -class TestCallbackContext extends HandleWrapperBase { - TestCallbackContext(Handle handle, AspireClient client) { +// ===== TestDeeplyNestedDto.java ===== +// TestDeeplyNestedDto.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** TestDeeplyNestedDto DTO. */ +public class TestDeeplyNestedDto { + private AspireDict> nestedData; + private AspireDict[] metadataArray; + + public AspireDict> getNestedData() { return nestedData; } + public void setNestedData(AspireDict> value) { this.nestedData = value; } + public AspireDict[] getMetadataArray() { return metadataArray; } + public void setMetadataArray(AspireDict[] value) { this.metadataArray = value; } + + public Map toMap() { + Map map = new HashMap<>(); + map.put("NestedData", AspireClient.serializeValue(nestedData)); + map.put("MetadataArray", AspireClient.serializeValue(metadataArray)); + return map; + } +} + +// ===== TestEnvironmentContext.java ===== +// TestEnvironmentContext.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestEnvironmentContext. */ +public class TestEnvironmentContext extends HandleWrapperBase { + TestEnvironmentContext(Handle handle, AspireClient client) { super(handle, client); } @@ -8640,93 +15335,146 @@ class TestCallbackContext extends HandleWrapperBase { public String name() { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (String) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestCallbackContext.name", reqArgs); + return (String) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestEnvironmentContext.name", reqArgs); } /** Sets the Name property */ - public TestCallbackContext setName(String value) { + public TestEnvironmentContext setName(String value) { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); reqArgs.put("value", AspireClient.serializeValue(value)); - return (TestCallbackContext) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestCallbackContext.setName", reqArgs); + return (TestEnvironmentContext) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestEnvironmentContext.setName", reqArgs); } - /** Gets the Value property */ - public double value() { + /** Gets the Description property */ + public String description() { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (double) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestCallbackContext.value", reqArgs); + return (String) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestEnvironmentContext.description", reqArgs); } - /** Sets the Value property */ - public TestCallbackContext setValue(double value) { + /** Sets the Description property */ + public TestEnvironmentContext setDescription(String value) { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); reqArgs.put("value", AspireClient.serializeValue(value)); - return (TestCallbackContext) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestCallbackContext.setValue", reqArgs); + return (TestEnvironmentContext) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestEnvironmentContext.setDescription", reqArgs); } - /** Gets the CancellationToken property */ - public CancellationToken cancellationToken() { + /** Gets the Priority property */ + public double priority() { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (CancellationToken) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestCallbackContext.cancellationToken", reqArgs); + return (double) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestEnvironmentContext.priority", reqArgs); } - /** Sets the CancellationToken property */ - public TestCallbackContext setCancellationToken(CancellationToken value) { + /** Sets the Priority property */ + public TestEnvironmentContext setPriority(double value) { Map reqArgs = new HashMap<>(); reqArgs.put("context", AspireClient.serializeValue(getHandle())); - if (value != null) { - reqArgs.put("value", getClient().registerCancellation(value)); - } - return (TestCallbackContext) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestCallbackContext.setCancellationToken", reqArgs); + reqArgs.put("value", AspireClient.serializeValue(value)); + return (TestEnvironmentContext) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestEnvironmentContext.setPriority", reqArgs); } } -/** Wrapper for Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestCollectionContext. */ -class TestCollectionContext extends HandleWrapperBase { - TestCollectionContext(Handle handle, AspireClient client) { - super(handle, client); +// ===== TestNestedDto.java ===== +// TestNestedDto.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** TestNestedDto DTO. */ +public class TestNestedDto { + private String id; + private TestConfigDto config; + private AspireList tags; + private AspireDict counts; + + public String getId() { return id; } + public void setId(String value) { this.id = value; } + public TestConfigDto getConfig() { return config; } + public void setConfig(TestConfigDto value) { this.config = value; } + public AspireList getTags() { return tags; } + public void setTags(AspireList value) { this.tags = value; } + public AspireDict getCounts() { return counts; } + public void setCounts(AspireDict value) { this.counts = value; } + + public Map toMap() { + Map map = new HashMap<>(); + map.put("Id", AspireClient.serializeValue(id)); + map.put("Config", AspireClient.serializeValue(config)); + map.put("Tags", AspireClient.serializeValue(tags)); + map.put("Counts", AspireClient.serializeValue(counts)); + return map; } +} - /** Gets the Items property */ - private AspireList itemsField; - public AspireList items() { - if (itemsField == null) { - itemsField = new AspireList<>(getHandle(), getClient(), "Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestCollectionContext.items"); - } - return itemsField; +// ===== TestPersistenceMode.java ===== +// TestPersistenceMode.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** TestPersistenceMode enum. */ +public enum TestPersistenceMode implements WireValueEnum { + NONE("None"), + VOLUME("Volume"), + BIND("Bind"); + + private final String value; + + TestPersistenceMode(String value) { + this.value = value; } - /** Gets the Metadata property */ - private AspireDict metadataField; - public AspireDict metadata() { - if (metadataField == null) { - metadataField = new AspireDict<>(getHandle(), getClient(), "Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestCollectionContext.metadata"); + public String getValue() { return value; } + + public static TestPersistenceMode fromValue(String value) { + for (TestPersistenceMode e : values()) { + if (e.value.equals(value)) return e; } - return metadataField; + throw new IllegalArgumentException("Unknown value: " + value); } - } -/** Wrapper for Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestDatabaseResource. */ -class TestDatabaseResource extends ResourceBuilderBase { - TestDatabaseResource(Handle handle, AspireClient client) { +// ===== TestRedisResource.java ===== +// TestRedisResource.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestRedisResource. */ +public class TestRedisResource extends ResourceBuilderBase { + TestRedisResource(Handle handle, AspireClient client) { super(handle, client); } /** Configures a resource to use a container registry */ - public IResource withContainerRegistry(IResource registry) { + public TestRedisResource withContainerRegistry(IResource registry) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("registry", AspireClient.serializeValue(registry)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withContainerRegistry", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withContainerRegistry", reqArgs); + return this; + } + + public TestRedisResource withContainerRegistry(ResourceBuilderBase registry) { + return withContainerRegistry(new IResource(registry.getHandle(), registry.getClient())); + } + + public TestRedisResource withBindMount(String source, String target) { + return withBindMount(source, target, null); } /** Adds a bind mount */ - public ContainerResource withBindMount(String source, String target, Boolean isReadOnly) { + public TestRedisResource withBindMount(String source, String target, Boolean isReadOnly) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("source", AspireClient.serializeValue(source)); @@ -8734,85 +15482,110 @@ public ContainerResource withBindMount(String source, String target, Boolean isR if (isReadOnly != null) { reqArgs.put("isReadOnly", AspireClient.serializeValue(isReadOnly)); } - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withBindMount", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withBindMount", reqArgs); + return this; } /** Sets the container entrypoint */ - public ContainerResource withEntrypoint(String entrypoint) { + public TestRedisResource withEntrypoint(String entrypoint) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("entrypoint", AspireClient.serializeValue(entrypoint)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withEntrypoint", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withEntrypoint", reqArgs); + return this; } /** Sets the container image tag */ - public ContainerResource withImageTag(String tag) { + public TestRedisResource withImageTag(String tag) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("tag", AspireClient.serializeValue(tag)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withImageTag", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withImageTag", reqArgs); + return this; } /** Sets the container image registry */ - public ContainerResource withImageRegistry(String registry) { + public TestRedisResource withImageRegistry(String registry) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("registry", AspireClient.serializeValue(registry)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withImageRegistry", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withImageRegistry", reqArgs); + return this; + } + + public TestRedisResource withImage(String image) { + return withImage(image, null); } /** Sets the container image */ - public ContainerResource withImage(String image, String tag) { + public TestRedisResource withImage(String image, String tag) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("image", AspireClient.serializeValue(image)); if (tag != null) { reqArgs.put("tag", AspireClient.serializeValue(tag)); } - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withImage", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withImage", reqArgs); + return this; } /** Sets the image SHA256 digest */ - public ContainerResource withImageSHA256(String sha256) { + public TestRedisResource withImageSHA256(String sha256) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("sha256", AspireClient.serializeValue(sha256)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withImageSHA256", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withImageSHA256", reqArgs); + return this; } /** Adds runtime arguments for the container */ - public ContainerResource withContainerRuntimeArgs(String[] args) { + public TestRedisResource withContainerRuntimeArgs(String[] args) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("args", AspireClient.serializeValue(args)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withContainerRuntimeArgs", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withContainerRuntimeArgs", reqArgs); + return this; } /** Sets the lifetime behavior of the container resource */ - public ContainerResource withLifetime(ContainerLifetime lifetime) { + public TestRedisResource withLifetime(ContainerLifetime lifetime) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("lifetime", AspireClient.serializeValue(lifetime)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withLifetime", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withLifetime", reqArgs); + return this; } /** Sets the container image pull policy */ - public ContainerResource withImagePullPolicy(ImagePullPolicy pullPolicy) { + public TestRedisResource withImagePullPolicy(ImagePullPolicy pullPolicy) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("pullPolicy", AspireClient.serializeValue(pullPolicy)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withImagePullPolicy", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withImagePullPolicy", reqArgs); + return this; } /** Configures the resource to be published as a container */ - public ContainerResource publishAsContainer() { + public TestRedisResource publishAsContainer() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/publishAsContainer", reqArgs); + getClient().invokeCapability("Aspire.Hosting/publishAsContainer", reqArgs); + return this; + } + + /** Configures the resource to use a Dockerfile */ + public TestRedisResource withDockerfile(String contextPath, WithDockerfileOptions options) { + var dockerfilePath = options == null ? null : options.getDockerfilePath(); + var stage = options == null ? null : options.getStage(); + return withDockerfileImpl(contextPath, dockerfilePath, stage); + } + + public TestRedisResource withDockerfile(String contextPath) { + return withDockerfile(contextPath, null); } /** Configures the resource to use a Dockerfile */ - public ContainerResource withDockerfile(String contextPath, String dockerfilePath, String stage) { + private TestRedisResource withDockerfileImpl(String contextPath, String dockerfilePath, String stage) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("contextPath", AspireClient.serializeValue(contextPath)); @@ -8822,45 +15595,61 @@ public ContainerResource withDockerfile(String contextPath, String dockerfilePat if (stage != null) { reqArgs.put("stage", AspireClient.serializeValue(stage)); } - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withDockerfile", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withDockerfile", reqArgs); + return this; } /** Sets the container name */ - public ContainerResource withContainerName(String name) { + public TestRedisResource withContainerName(String name) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("name", AspireClient.serializeValue(name)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withContainerName", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withContainerName", reqArgs); + return this; } /** Adds a build argument from a parameter resource */ - public ContainerResource withBuildArg(String name, ParameterResource value) { + public TestRedisResource withBuildArg(String name, ParameterResource value) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("name", AspireClient.serializeValue(name)); reqArgs.put("value", AspireClient.serializeValue(value)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withBuildArg", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withBuildArg", reqArgs); + return this; } /** Adds a build secret from a parameter resource */ - public ContainerResource withBuildSecret(String name, ParameterResource value) { + public TestRedisResource withBuildSecret(String name, ParameterResource value) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("name", AspireClient.serializeValue(name)); reqArgs.put("value", AspireClient.serializeValue(value)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withBuildSecret", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withBuildSecret", reqArgs); + return this; } /** Configures endpoint proxy support */ - public ContainerResource withEndpointProxySupport(boolean proxyEnabled) { + public TestRedisResource withEndpointProxySupport(boolean proxyEnabled) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("proxyEnabled", AspireClient.serializeValue(proxyEnabled)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withEndpointProxySupport", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withEndpointProxySupport", reqArgs); + return this; + } + + /** Sets the base image for a Dockerfile build */ + public TestRedisResource withDockerfileBaseImage(WithDockerfileBaseImageOptions options) { + var buildImage = options == null ? null : options.getBuildImage(); + var runtimeImage = options == null ? null : options.getRuntimeImage(); + return withDockerfileBaseImageImpl(buildImage, runtimeImage); + } + + public TestRedisResource withDockerfileBaseImage() { + return withDockerfileBaseImage(null); } /** Sets the base image for a Dockerfile build */ - public IResource withDockerfileBaseImage(String buildImage, String runtimeImage) { + private TestRedisResource withDockerfileBaseImageImpl(String buildImage, String runtimeImage) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); if (buildImage != null) { @@ -8869,19 +15658,32 @@ public IResource withDockerfileBaseImage(String buildImage, String runtimeImage) if (runtimeImage != null) { reqArgs.put("runtimeImage", AspireClient.serializeValue(runtimeImage)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withDockerfileBaseImage", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withDockerfileBaseImage", reqArgs); + return this; } /** Adds a network alias for the container */ - public ContainerResource withContainerNetworkAlias(String alias) { + public TestRedisResource withContainerNetworkAlias(String alias) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("alias", AspireClient.serializeValue(alias)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withContainerNetworkAlias", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withContainerNetworkAlias", reqArgs); + return this; + } + + /** Configures an MCP server endpoint on the resource */ + public TestRedisResource withMcpServer(WithMcpServerOptions options) { + var path = options == null ? null : options.getPath(); + var endpointName = options == null ? null : options.getEndpointName(); + return withMcpServerImpl(path, endpointName); + } + + public TestRedisResource withMcpServer() { + return withMcpServer(null); } /** Configures an MCP server endpoint on the resource */ - public IResourceWithEndpoints withMcpServer(String path, String endpointName) { + private TestRedisResource withMcpServerImpl(String path, String endpointName) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); if (path != null) { @@ -8890,137 +15692,220 @@ public IResourceWithEndpoints withMcpServer(String path, String endpointName) { if (endpointName != null) { reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withMcpServer", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withMcpServer", reqArgs); + return this; } /** Configures OTLP telemetry export */ - public IResourceWithEnvironment withOtlpExporter() { + public TestRedisResource withOtlpExporter() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withOtlpExporter", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withOtlpExporter", reqArgs); + return this; } /** Configures OTLP telemetry export with specific protocol */ - public IResourceWithEnvironment withOtlpExporterProtocol(OtlpProtocol protocol) { + public TestRedisResource withOtlpExporterProtocol(OtlpProtocol protocol) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("protocol", AspireClient.serializeValue(protocol)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withOtlpExporterProtocol", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withOtlpExporterProtocol", reqArgs); + return this; } /** Publishes the resource as a connection string */ - public ContainerResource publishAsConnectionString() { + public TestRedisResource publishAsConnectionString() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/publishAsConnectionString", reqArgs); + getClient().invokeCapability("Aspire.Hosting/publishAsConnectionString", reqArgs); + return this; + } + + public TestRedisResource withRequiredCommand(String command) { + return withRequiredCommand(command, null); } /** Adds a required command dependency */ - public IResource withRequiredCommand(String command, String helpLink) { + public TestRedisResource withRequiredCommand(String command, String helpLink) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("command", AspireClient.serializeValue(command)); if (helpLink != null) { reqArgs.put("helpLink", AspireClient.serializeValue(helpLink)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withRequiredCommand", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withRequiredCommand", reqArgs); + return this; } /** Sets an environment variable */ - public IResourceWithEnvironment withEnvironment(String name, String value) { + public TestRedisResource withEnvironment(String name, String value) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("name", AspireClient.serializeValue(name)); reqArgs.put("value", AspireClient.serializeValue(value)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironment", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withEnvironment", reqArgs); + return this; } /** Adds an environment variable with a reference expression */ - public IResourceWithEnvironment withEnvironmentExpression(String name, ReferenceExpression value) { + public TestRedisResource withEnvironmentExpression(String name, ReferenceExpression value) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("name", AspireClient.serializeValue(name)); reqArgs.put("value", AspireClient.serializeValue(value)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentExpression", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentExpression", reqArgs); + return this; } /** Sets environment variables via callback */ - public IResourceWithEnvironment withEnvironmentCallback(Function callback) { + public TestRedisResource withEnvironmentCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var obj = (EnvironmentCallbackContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentCallback", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentCallback", reqArgs); + return this; } /** Sets environment variables via async callback */ - public IResourceWithEnvironment withEnvironmentCallbackAsync(Function callback) { + public TestRedisResource withEnvironmentCallbackAsync(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var arg = (EnvironmentCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentCallbackAsync", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentCallbackAsync", reqArgs); + return this; } /** Sets an environment variable from an endpoint reference */ - public IResourceWithEnvironment withEnvironmentEndpoint(String name, EndpointReference endpointReference) { + public TestRedisResource withEnvironmentEndpoint(String name, EndpointReference endpointReference) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("name", AspireClient.serializeValue(name)); reqArgs.put("endpointReference", AspireClient.serializeValue(endpointReference)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentEndpoint", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentEndpoint", reqArgs); + return this; } /** Sets an environment variable from a parameter resource */ - public IResourceWithEnvironment withEnvironmentParameter(String name, ParameterResource parameter) { + public TestRedisResource withEnvironmentParameter(String name, ParameterResource parameter) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("name", AspireClient.serializeValue(name)); reqArgs.put("parameter", AspireClient.serializeValue(parameter)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentParameter", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentParameter", reqArgs); + return this; } /** Sets an environment variable from a connection string resource */ - public IResourceWithEnvironment withEnvironmentConnectionString(String envVarName, IResourceWithConnectionString resource) { + public TestRedisResource withEnvironmentConnectionString(String envVarName, IResourceWithConnectionString resource) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("envVarName", AspireClient.serializeValue(envVarName)); reqArgs.put("resource", AspireClient.serializeValue(resource)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentConnectionString", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentConnectionString", reqArgs); + return this; + } + + public TestRedisResource withEnvironmentConnectionString(String envVarName, ResourceBuilderBase resource) { + return withEnvironmentConnectionString(envVarName, new IResourceWithConnectionString(resource.getHandle(), resource.getClient())); + } + + /** Adds a connection property with a reference expression */ + public TestRedisResource withConnectionProperty(String name, ReferenceExpression value) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("value", AspireClient.serializeValue(value)); + getClient().invokeCapability("Aspire.Hosting/withConnectionProperty", reqArgs); + return this; + } + + /** Adds a connection property with a string value */ + public TestRedisResource withConnectionPropertyValue(String name, String value) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("value", AspireClient.serializeValue(value)); + getClient().invokeCapability("Aspire.Hosting/withConnectionPropertyValue", reqArgs); + return this; } /** Adds arguments */ - public IResourceWithArgs withArgs(String[] args) { + public TestRedisResource withArgs(String[] args) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("args", AspireClient.serializeValue(args)); - return (IResourceWithArgs) getClient().invokeCapability("Aspire.Hosting/withArgs", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withArgs", reqArgs); + return this; } /** Sets command-line arguments via callback */ - public IResourceWithArgs withArgsCallback(Function callback) { + public TestRedisResource withArgsCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var obj = (CommandLineArgsCallbackContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResourceWithArgs) getClient().invokeCapability("Aspire.Hosting/withArgsCallback", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withArgsCallback", reqArgs); + return this; } /** Sets command-line arguments via async callback */ - public IResourceWithArgs withArgsCallbackAsync(Function callback) { + public TestRedisResource withArgsCallbackAsync(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var arg = (CommandLineArgsCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResourceWithArgs) getClient().invokeCapability("Aspire.Hosting/withArgsCallbackAsync", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withArgsCallbackAsync", reqArgs); + return this; + } + + /** Adds a reference to another resource */ + public TestRedisResource withReference(IResource source, WithReferenceOptions options) { + var connectionName = options == null ? null : options.getConnectionName(); + var optional = options == null ? null : options.getOptional(); + var name = options == null ? null : options.getName(); + return withReferenceImpl(source, connectionName, optional, name); + } + + public TestRedisResource withReference(ResourceBuilderBase source, WithReferenceOptions options) { + return withReference(new IResource(source.getHandle(), source.getClient()), options); + } + + public TestRedisResource withReference(IResource source) { + return withReference(source, null); + } + + public TestRedisResource withReference(ResourceBuilderBase source) { + return withReference(new IResource(source.getHandle(), source.getClient())); } /** Adds a reference to another resource */ - public IResourceWithEnvironment withReference(IResource source, String connectionName, Boolean optional, String name) { + private TestRedisResource withReferenceImpl(IResource source, String connectionName, Boolean optional, String name) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("source", AspireClient.serializeValue(source)); @@ -9033,36 +15918,57 @@ public IResourceWithEnvironment withReference(IResource source, String connectio if (name != null) { reqArgs.put("name", AspireClient.serializeValue(name)); } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withReference", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withReference", reqArgs); + return this; } /** Adds a reference to a URI */ - public IResourceWithEnvironment withReferenceUri(String name, String uri) { + public TestRedisResource withReferenceUri(String name, String uri) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("name", AspireClient.serializeValue(name)); reqArgs.put("uri", AspireClient.serializeValue(uri)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withReferenceUri", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withReferenceUri", reqArgs); + return this; } /** Adds a reference to an external service */ - public IResourceWithEnvironment withReferenceExternalService(ExternalServiceResource externalService) { + public TestRedisResource withReferenceExternalService(ExternalServiceResource externalService) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("externalService", AspireClient.serializeValue(externalService)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withReferenceExternalService", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withReferenceExternalService", reqArgs); + return this; } /** Adds a reference to an endpoint */ - public IResourceWithEnvironment withReferenceEndpoint(EndpointReference endpointReference) { + public TestRedisResource withReferenceEndpoint(EndpointReference endpointReference) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("endpointReference", AspireClient.serializeValue(endpointReference)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withReferenceEndpoint", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withReferenceEndpoint", reqArgs); + return this; + } + + /** Adds a network endpoint */ + public TestRedisResource withEndpoint(WithEndpointOptions options) { + var port = options == null ? null : options.getPort(); + var targetPort = options == null ? null : options.getTargetPort(); + var scheme = options == null ? null : options.getScheme(); + var name = options == null ? null : options.getName(); + var env = options == null ? null : options.getEnv(); + var isProxied = options == null ? null : options.isProxied(); + var isExternal = options == null ? null : options.isExternal(); + var protocol = options == null ? null : options.getProtocol(); + return withEndpointImpl(port, targetPort, scheme, name, env, isProxied, isExternal, protocol); + } + + public TestRedisResource withEndpoint() { + return withEndpoint(null); } /** Adds a network endpoint */ - public IResourceWithEndpoints withEndpoint(Double port, Double targetPort, String scheme, String name, String env, Boolean isProxied, Boolean isExternal, ProtocolType protocol) { + private TestRedisResource withEndpointImpl(Double port, Double targetPort, String scheme, String name, String env, Boolean isProxied, Boolean isExternal, ProtocolType protocol) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); if (port != null) { @@ -9089,11 +15995,26 @@ public IResourceWithEndpoints withEndpoint(Double port, Double targetPort, Strin if (protocol != null) { reqArgs.put("protocol", AspireClient.serializeValue(protocol)); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withEndpoint", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withEndpoint", reqArgs); + return this; + } + + /** Adds an HTTP endpoint */ + public TestRedisResource withHttpEndpoint(WithHttpEndpointOptions options) { + var port = options == null ? null : options.getPort(); + var targetPort = options == null ? null : options.getTargetPort(); + var name = options == null ? null : options.getName(); + var env = options == null ? null : options.getEnv(); + var isProxied = options == null ? null : options.isProxied(); + return withHttpEndpointImpl(port, targetPort, name, env, isProxied); + } + + public TestRedisResource withHttpEndpoint() { + return withHttpEndpoint(null); } /** Adds an HTTP endpoint */ - public IResourceWithEndpoints withHttpEndpoint(Double port, Double targetPort, String name, String env, Boolean isProxied) { + private TestRedisResource withHttpEndpointImpl(Double port, Double targetPort, String name, String env, Boolean isProxied) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); if (port != null) { @@ -9111,11 +16032,26 @@ public IResourceWithEndpoints withHttpEndpoint(Double port, Double targetPort, S if (isProxied != null) { reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withHttpEndpoint", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withHttpEndpoint", reqArgs); + return this; } /** Adds an HTTPS endpoint */ - public IResourceWithEndpoints withHttpsEndpoint(Double port, Double targetPort, String name, String env, Boolean isProxied) { + public TestRedisResource withHttpsEndpoint(WithHttpsEndpointOptions options) { + var port = options == null ? null : options.getPort(); + var targetPort = options == null ? null : options.getTargetPort(); + var name = options == null ? null : options.getName(); + var env = options == null ? null : options.getEnv(); + var isProxied = options == null ? null : options.isProxied(); + return withHttpsEndpointImpl(port, targetPort, name, env, isProxied); + } + + public TestRedisResource withHttpsEndpoint() { + return withHttpsEndpoint(null); + } + + /** Adds an HTTPS endpoint */ + private TestRedisResource withHttpsEndpointImpl(Double port, Double targetPort, String name, String env, Boolean isProxied) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); if (port != null) { @@ -9133,14 +16069,16 @@ public IResourceWithEndpoints withHttpsEndpoint(Double port, Double targetPort, if (isProxied != null) { reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withHttpsEndpoint", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withHttpsEndpoint", reqArgs); + return this; } /** Makes HTTP endpoints externally accessible */ - public IResourceWithEndpoints withExternalHttpEndpoints() { + public TestRedisResource withExternalHttpEndpoints() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withExternalHttpEndpoints", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withExternalHttpEndpoints", reqArgs); + return this; } /** Gets an endpoint reference */ @@ -9152,145 +16090,227 @@ public EndpointReference getEndpoint(String name) { } /** Configures resource for HTTP/2 */ - public IResourceWithEndpoints asHttp2Service() { + public TestRedisResource asHttp2Service() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/asHttp2Service", reqArgs); + getClient().invokeCapability("Aspire.Hosting/asHttp2Service", reqArgs); + return this; } /** Customizes displayed URLs via callback */ - public IResource withUrlsCallback(Function callback) { + public TestRedisResource withUrlsCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var obj = (ResourceUrlsCallbackContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlsCallback", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrlsCallback", reqArgs); + return this; } /** Customizes displayed URLs via async callback */ - public IResource withUrlsCallbackAsync(Function callback) { + public TestRedisResource withUrlsCallbackAsync(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceUrlsCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlsCallbackAsync", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrlsCallbackAsync", reqArgs); + return this; + } + + public TestRedisResource withUrl(String url) { + return withUrl(url, null); } /** Adds or modifies displayed URLs */ - public IResource withUrl(String url, String displayText) { + public TestRedisResource withUrl(String url, String displayText) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("url", AspireClient.serializeValue(url)); if (displayText != null) { reqArgs.put("displayText", AspireClient.serializeValue(displayText)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrl", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrl", reqArgs); + return this; + } + + public TestRedisResource withUrlExpression(ReferenceExpression url) { + return withUrlExpression(url, null); } /** Adds a URL using a reference expression */ - public IResource withUrlExpression(ReferenceExpression url, String displayText) { + public TestRedisResource withUrlExpression(ReferenceExpression url, String displayText) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("url", AspireClient.serializeValue(url)); if (displayText != null) { reqArgs.put("displayText", AspireClient.serializeValue(displayText)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlExpression", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrlExpression", reqArgs); + return this; } /** Customizes the URL for a specific endpoint via callback */ - public IResource withUrlForEndpoint(String endpointName, Function callback) { + public TestRedisResource withUrlForEndpoint(String endpointName, AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var obj = (ResourceUrlAnnotation) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlForEndpoint", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrlForEndpoint", reqArgs); + return this; } /** Adds a URL for a specific endpoint via factory callback */ - public IResourceWithEndpoints withUrlForEndpointFactory(String endpointName, Function callback) { + public TestRedisResource withUrlForEndpointFactory(String endpointName, AspireFunc1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var arg = (EndpointReference) args[0]; + return AspireClient.awaitValue(callback.invoke(arg)); + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withUrlForEndpointFactory", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrlForEndpointFactory", reqArgs); + return this; } /** Excludes the resource from the deployment manifest */ - public IResource excludeFromManifest() { + public TestRedisResource excludeFromManifest() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/excludeFromManifest", reqArgs); + getClient().invokeCapability("Aspire.Hosting/excludeFromManifest", reqArgs); + return this; } /** Waits for another resource to be ready */ - public IResourceWithWaitSupport waitFor(IResource dependency) { + public TestRedisResource waitFor(IResource dependency) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitFor", reqArgs); + getClient().invokeCapability("Aspire.Hosting/waitFor", reqArgs); + return this; + } + + public TestRedisResource waitFor(ResourceBuilderBase dependency) { + return waitFor(new IResource(dependency.getHandle(), dependency.getClient())); } /** Waits for another resource with specific behavior */ - public IResourceWithWaitSupport waitForWithBehavior(IResource dependency, WaitBehavior waitBehavior) { + public TestRedisResource waitForWithBehavior(IResource dependency, WaitBehavior waitBehavior) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("dependency", AspireClient.serializeValue(dependency)); reqArgs.put("waitBehavior", AspireClient.serializeValue(waitBehavior)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForWithBehavior", reqArgs); + getClient().invokeCapability("Aspire.Hosting/waitForWithBehavior", reqArgs); + return this; + } + + public TestRedisResource waitForWithBehavior(ResourceBuilderBase dependency, WaitBehavior waitBehavior) { + return waitForWithBehavior(new IResource(dependency.getHandle(), dependency.getClient()), waitBehavior); } /** Waits for another resource to start */ - public IResourceWithWaitSupport waitForStart(IResource dependency) { + public TestRedisResource waitForStart(IResource dependency) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForStart", reqArgs); + getClient().invokeCapability("Aspire.Hosting/waitForStart", reqArgs); + return this; + } + + public TestRedisResource waitForStart(ResourceBuilderBase dependency) { + return waitForStart(new IResource(dependency.getHandle(), dependency.getClient())); } /** Waits for another resource to start with specific behavior */ - public IResourceWithWaitSupport waitForStartWithBehavior(IResource dependency, WaitBehavior waitBehavior) { + public TestRedisResource waitForStartWithBehavior(IResource dependency, WaitBehavior waitBehavior) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("dependency", AspireClient.serializeValue(dependency)); reqArgs.put("waitBehavior", AspireClient.serializeValue(waitBehavior)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForStartWithBehavior", reqArgs); + getClient().invokeCapability("Aspire.Hosting/waitForStartWithBehavior", reqArgs); + return this; + } + + public TestRedisResource waitForStartWithBehavior(ResourceBuilderBase dependency, WaitBehavior waitBehavior) { + return waitForStartWithBehavior(new IResource(dependency.getHandle(), dependency.getClient()), waitBehavior); } /** Prevents resource from starting automatically */ - public IResource withExplicitStart() { + public TestRedisResource withExplicitStart() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withExplicitStart", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withExplicitStart", reqArgs); + return this; + } + + public TestRedisResource waitForCompletion(IResource dependency) { + return waitForCompletion(dependency, null); + } + + public TestRedisResource waitForCompletion(ResourceBuilderBase dependency) { + return waitForCompletion(new IResource(dependency.getHandle(), dependency.getClient())); } /** Waits for resource completion */ - public IResourceWithWaitSupport waitForCompletion(IResource dependency, Double exitCode) { + public TestRedisResource waitForCompletion(IResource dependency, Double exitCode) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("dependency", AspireClient.serializeValue(dependency)); if (exitCode != null) { reqArgs.put("exitCode", AspireClient.serializeValue(exitCode)); } - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForCompletion", reqArgs); + getClient().invokeCapability("Aspire.Hosting/waitForCompletion", reqArgs); + return this; + } + + public TestRedisResource waitForCompletion(ResourceBuilderBase dependency, Double exitCode) { + return waitForCompletion(new IResource(dependency.getHandle(), dependency.getClient()), exitCode); } /** Adds a health check by key */ - public IResource withHealthCheck(String key) { + public TestRedisResource withHealthCheck(String key) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("key", AspireClient.serializeValue(key)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withHealthCheck", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withHealthCheck", reqArgs); + return this; + } + + /** Adds an HTTP health check */ + public TestRedisResource withHttpHealthCheck(WithHttpHealthCheckOptions options) { + var path = options == null ? null : options.getPath(); + var statusCode = options == null ? null : options.getStatusCode(); + var endpointName = options == null ? null : options.getEndpointName(); + return withHttpHealthCheckImpl(path, statusCode, endpointName); + } + + public TestRedisResource withHttpHealthCheck() { + return withHttpHealthCheck(null); } /** Adds an HTTP health check */ - public IResourceWithEndpoints withHttpHealthCheck(String path, Double statusCode, String endpointName) { + private TestRedisResource withHttpHealthCheckImpl(String path, Double statusCode, String endpointName) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); if (path != null) { @@ -9302,2738 +16322,3034 @@ public IResourceWithEndpoints withHttpHealthCheck(String path, Double statusCode if (endpointName != null) { reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withHttpHealthCheck", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withHttpHealthCheck", reqArgs); + return this; + } + + public TestRedisResource withCommand(String name, String displayName, AspireFunc1 executeCommand) { + return withCommand(name, displayName, executeCommand, null); } /** Adds a resource command */ - public IResource withCommand(String name, String displayName, Function executeCommand, CommandOptions commandOptions) { + public TestRedisResource withCommand(String name, String displayName, AspireFunc1 executeCommand, CommandOptions commandOptions) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("name", AspireClient.serializeValue(name)); reqArgs.put("displayName", AspireClient.serializeValue(displayName)); - if (executeCommand != null) { - reqArgs.put("executeCommand", getClient().registerCallback(executeCommand)); + var executeCommandId = getClient().registerCallback(args -> { + var arg = (ExecuteCommandContext) args[0]; + return AspireClient.awaitValue(executeCommand.invoke(arg)); + }); + if (executeCommandId != null) { + reqArgs.put("executeCommand", executeCommandId); } if (commandOptions != null) { reqArgs.put("commandOptions", AspireClient.serializeValue(commandOptions)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withCommand", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withCommand", reqArgs); + return this; } /** Configures developer certificate trust */ - public IResourceWithEnvironment withDeveloperCertificateTrust(boolean trust) { + public TestRedisResource withDeveloperCertificateTrust(boolean trust) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("trust", AspireClient.serializeValue(trust)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withDeveloperCertificateTrust", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withDeveloperCertificateTrust", reqArgs); + return this; } /** Sets the certificate trust scope */ - public IResourceWithEnvironment withCertificateTrustScope(CertificateTrustScope scope) { + public TestRedisResource withCertificateTrustScope(CertificateTrustScope scope) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("scope", AspireClient.serializeValue(scope)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withCertificateTrustScope", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withCertificateTrustScope", reqArgs); + return this; + } + + public TestRedisResource withHttpsDeveloperCertificate() { + return withHttpsDeveloperCertificate(null); } /** Configures HTTPS with a developer certificate */ - public IResourceWithEnvironment withHttpsDeveloperCertificate(ParameterResource password) { + public TestRedisResource withHttpsDeveloperCertificate(ParameterResource password) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); if (password != null) { reqArgs.put("password", AspireClient.serializeValue(password)); } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withHttpsDeveloperCertificate", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withHttpsDeveloperCertificate", reqArgs); + return this; } /** Removes HTTPS certificate configuration */ - public IResourceWithEnvironment withoutHttpsCertificate() { + public TestRedisResource withoutHttpsCertificate() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withoutHttpsCertificate", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withoutHttpsCertificate", reqArgs); + return this; } /** Sets the parent relationship */ - public IResource withParentRelationship(IResource parent) { + public TestRedisResource withParentRelationship(IResource parent) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); reqArgs.put("parent", AspireClient.serializeValue(parent)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withParentRelationship", reqArgs); - } - - /** Sets a child relationship */ - public IResource withChildRelationship(IResource child) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("child", AspireClient.serializeValue(child)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withChildRelationship", reqArgs); - } - - /** Sets the icon for the resource */ - public IResource withIconName(String iconName, IconVariant iconVariant) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("iconName", AspireClient.serializeValue(iconName)); - if (iconVariant != null) { - reqArgs.put("iconVariant", AspireClient.serializeValue(iconVariant)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withIconName", reqArgs); - } - - /** Adds an HTTP health probe to the resource */ - public IResourceWithEndpoints withHttpProbe(ProbeType probeType, String path, Double initialDelaySeconds, Double periodSeconds, Double timeoutSeconds, Double failureThreshold, Double successThreshold, String endpointName) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("probeType", AspireClient.serializeValue(probeType)); - if (path != null) { - reqArgs.put("path", AspireClient.serializeValue(path)); - } - if (initialDelaySeconds != null) { - reqArgs.put("initialDelaySeconds", AspireClient.serializeValue(initialDelaySeconds)); - } - if (periodSeconds != null) { - reqArgs.put("periodSeconds", AspireClient.serializeValue(periodSeconds)); - } - if (timeoutSeconds != null) { - reqArgs.put("timeoutSeconds", AspireClient.serializeValue(timeoutSeconds)); - } - if (failureThreshold != null) { - reqArgs.put("failureThreshold", AspireClient.serializeValue(failureThreshold)); - } - if (successThreshold != null) { - reqArgs.put("successThreshold", AspireClient.serializeValue(successThreshold)); - } - if (endpointName != null) { - reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); - } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withHttpProbe", reqArgs); - } - - /** Excludes the resource from MCP server exposure */ - public IResource excludeFromMcp() { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/excludeFromMcp", reqArgs); - } - - /** Sets the remote image name for publishing */ - public IComputeResource withRemoteImageName(String remoteImageName) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("remoteImageName", AspireClient.serializeValue(remoteImageName)); - return (IComputeResource) getClient().invokeCapability("Aspire.Hosting/withRemoteImageName", reqArgs); - } - - /** Sets the remote image tag for publishing */ - public IComputeResource withRemoteImageTag(String remoteImageTag) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("remoteImageTag", AspireClient.serializeValue(remoteImageTag)); - return (IComputeResource) getClient().invokeCapability("Aspire.Hosting/withRemoteImageTag", reqArgs); - } - - /** Adds a pipeline step to the resource */ - public IResource withPipelineStepFactory(String stepName, Function callback, String[] dependsOn, String[] requiredBy, String[] tags, String description) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("stepName", AspireClient.serializeValue(stepName)); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - if (dependsOn != null) { - reqArgs.put("dependsOn", AspireClient.serializeValue(dependsOn)); - } - if (requiredBy != null) { - reqArgs.put("requiredBy", AspireClient.serializeValue(requiredBy)); - } - if (tags != null) { - reqArgs.put("tags", AspireClient.serializeValue(tags)); - } - if (description != null) { - reqArgs.put("description", AspireClient.serializeValue(description)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withPipelineStepFactory", reqArgs); - } - - /** Configures pipeline step dependencies via an async callback */ - public IResource withPipelineConfigurationAsync(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withPipelineConfigurationAsync", reqArgs); - } - - /** Configures pipeline step dependencies via a callback */ - public IResource withPipelineConfiguration(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withPipelineConfiguration", reqArgs); - } - - /** Adds a volume */ - public ContainerResource withVolume(String target, String name, Boolean isReadOnly) { - Map reqArgs = new HashMap<>(); - reqArgs.put("resource", AspireClient.serializeValue(getHandle())); - reqArgs.put("target", AspireClient.serializeValue(target)); - if (name != null) { - reqArgs.put("name", AspireClient.serializeValue(name)); - } - if (isReadOnly != null) { - reqArgs.put("isReadOnly", AspireClient.serializeValue(isReadOnly)); - } - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withVolume", reqArgs); - } - - /** Gets the resource name */ - public String getResourceName() { - Map reqArgs = new HashMap<>(); - reqArgs.put("resource", AspireClient.serializeValue(getHandle())); - return (String) getClient().invokeCapability("Aspire.Hosting/getResourceName", reqArgs); - } - - /** Subscribes to the BeforeResourceStarted event */ - public IResource onBeforeResourceStarted(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onBeforeResourceStarted", reqArgs); - } - - /** Subscribes to the ResourceStopped event */ - public IResource onResourceStopped(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onResourceStopped", reqArgs); - } - - /** Subscribes to the InitializeResource event */ - public IResource onInitializeResource(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onInitializeResource", reqArgs); - } - - /** Subscribes to the ResourceEndpointsAllocated event */ - public IResourceWithEndpoints onResourceEndpointsAllocated(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/onResourceEndpointsAllocated", reqArgs); - } - - /** Subscribes to the ResourceReady event */ - public IResource onResourceReady(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onResourceReady", reqArgs); - } - - /** Adds an optional string parameter */ - public IResource withOptionalString(String value, Boolean enabled) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (value != null) { - reqArgs.put("value", AspireClient.serializeValue(value)); - } - if (enabled != null) { - reqArgs.put("enabled", AspireClient.serializeValue(enabled)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalString", reqArgs); - } - - /** Configures the resource with a DTO */ - public IResource withConfig(TestConfigDto config) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("config", AspireClient.serializeValue(config)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConfig", reqArgs); - } - - /** Configures environment with callback (test version) */ - public IResourceWithEnvironment testWithEnvironmentCallback(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWithEnvironmentCallback", reqArgs); - } - - /** Sets the created timestamp */ - public IResource withCreatedAt(String createdAt) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("createdAt", AspireClient.serializeValue(createdAt)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCreatedAt", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withParentRelationship", reqArgs); + return this; } - /** Sets the modified timestamp */ - public IResource withModifiedAt(String modifiedAt) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("modifiedAt", AspireClient.serializeValue(modifiedAt)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withModifiedAt", reqArgs); - } - - /** Sets the correlation ID */ - public IResource withCorrelationId(String correlationId) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("correlationId", AspireClient.serializeValue(correlationId)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCorrelationId", reqArgs); - } - - /** Configures with optional callback */ - public IResource withOptionalCallback(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalCallback", reqArgs); + public TestRedisResource withParentRelationship(ResourceBuilderBase parent) { + return withParentRelationship(new IResource(parent.getHandle(), parent.getClient())); } - /** Sets the resource status */ - public IResource withStatus(TestResourceStatus status) { + /** Sets a child relationship */ + public TestRedisResource withChildRelationship(IResource child) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("status", AspireClient.serializeValue(status)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withStatus", reqArgs); + reqArgs.put("child", AspireClient.serializeValue(child)); + getClient().invokeCapability("Aspire.Hosting/withChildRelationship", reqArgs); + return this; } - /** Configures with nested DTO */ - public IResource withNestedConfig(TestNestedDto config) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("config", AspireClient.serializeValue(config)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withNestedConfig", reqArgs); + public TestRedisResource withChildRelationship(ResourceBuilderBase child) { + return withChildRelationship(new IResource(child.getHandle(), child.getClient())); } - /** Adds validation callback */ - public IResource withValidator(Function validator) { + public TestRedisResource withIconName(String iconName) { + return withIconName(iconName, null); + } + + /** Sets the icon for the resource */ + public TestRedisResource withIconName(String iconName, IconVariant iconVariant) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (validator != null) { - reqArgs.put("validator", getClient().registerCallback(validator)); + reqArgs.put("iconName", AspireClient.serializeValue(iconName)); + if (iconVariant != null) { + reqArgs.put("iconVariant", AspireClient.serializeValue(iconVariant)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withValidator", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withIconName", reqArgs); + return this; } - /** Waits for another resource (test version) */ - public IResource testWaitFor(IResource dependency) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWaitFor", reqArgs); + /** Adds an HTTP health probe to the resource */ + public TestRedisResource withHttpProbe(ProbeType probeType, WithHttpProbeOptions options) { + var path = options == null ? null : options.getPath(); + var initialDelaySeconds = options == null ? null : options.getInitialDelaySeconds(); + var periodSeconds = options == null ? null : options.getPeriodSeconds(); + var timeoutSeconds = options == null ? null : options.getTimeoutSeconds(); + var failureThreshold = options == null ? null : options.getFailureThreshold(); + var successThreshold = options == null ? null : options.getSuccessThreshold(); + var endpointName = options == null ? null : options.getEndpointName(); + return withHttpProbeImpl(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName); } - /** Adds a dependency on another resource */ - public IResource withDependency(IResourceWithConnectionString dependency) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDependency", reqArgs); + public TestRedisResource withHttpProbe(ProbeType probeType) { + return withHttpProbe(probeType, null); } - /** Sets the endpoints */ - public IResource withEndpoints(String[] endpoints) { + /** Adds an HTTP health probe to the resource */ + private TestRedisResource withHttpProbeImpl(ProbeType probeType, String path, Double initialDelaySeconds, Double periodSeconds, Double timeoutSeconds, Double failureThreshold, Double successThreshold, String endpointName) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("endpoints", AspireClient.serializeValue(endpoints)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEndpoints", reqArgs); + reqArgs.put("probeType", AspireClient.serializeValue(probeType)); + if (path != null) { + reqArgs.put("path", AspireClient.serializeValue(path)); + } + if (initialDelaySeconds != null) { + reqArgs.put("initialDelaySeconds", AspireClient.serializeValue(initialDelaySeconds)); + } + if (periodSeconds != null) { + reqArgs.put("periodSeconds", AspireClient.serializeValue(periodSeconds)); + } + if (timeoutSeconds != null) { + reqArgs.put("timeoutSeconds", AspireClient.serializeValue(timeoutSeconds)); + } + if (failureThreshold != null) { + reqArgs.put("failureThreshold", AspireClient.serializeValue(failureThreshold)); + } + if (successThreshold != null) { + reqArgs.put("successThreshold", AspireClient.serializeValue(successThreshold)); + } + if (endpointName != null) { + reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + } + getClient().invokeCapability("Aspire.Hosting/withHttpProbe", reqArgs); + return this; } - /** Sets environment variables */ - public IResourceWithEnvironment withEnvironmentVariables(Map variables) { + /** Excludes the resource from MCP server exposure */ + public TestRedisResource excludeFromMcp() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("variables", AspireClient.serializeValue(variables)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEnvironmentVariables", reqArgs); + getClient().invokeCapability("Aspire.Hosting/excludeFromMcp", reqArgs); + return this; } - /** Performs a cancellable operation */ - public IResource withCancellableOperation(Function operation) { + /** Sets the remote image name for publishing */ + public TestRedisResource withRemoteImageName(String remoteImageName) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (operation != null) { - reqArgs.put("operation", getClient().registerCallback(operation)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCancellableOperation", reqArgs); - } - -} - -/** Wrapper for Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestEnvironmentContext. */ -class TestEnvironmentContext extends HandleWrapperBase { - TestEnvironmentContext(Handle handle, AspireClient client) { - super(handle, client); + reqArgs.put("remoteImageName", AspireClient.serializeValue(remoteImageName)); + getClient().invokeCapability("Aspire.Hosting/withRemoteImageName", reqArgs); + return this; } - /** Gets the Name property */ - public String name() { + /** Sets the remote image tag for publishing */ + public TestRedisResource withRemoteImageTag(String remoteImageTag) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (String) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestEnvironmentContext.name", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("remoteImageTag", AspireClient.serializeValue(remoteImageTag)); + getClient().invokeCapability("Aspire.Hosting/withRemoteImageTag", reqArgs); + return this; } - /** Sets the Name property */ - public TestEnvironmentContext setName(String value) { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (TestEnvironmentContext) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestEnvironmentContext.setName", reqArgs); + /** Adds a pipeline step to the resource */ + public TestRedisResource withPipelineStepFactory(String stepName, AspireAction1 callback, WithPipelineStepFactoryOptions options) { + var dependsOn = options == null ? null : options.getDependsOn(); + var requiredBy = options == null ? null : options.getRequiredBy(); + var tags = options == null ? null : options.getTags(); + var description = options == null ? null : options.getDescription(); + return withPipelineStepFactoryImpl(stepName, callback, dependsOn, requiredBy, tags, description); } - /** Gets the Description property */ - public String description() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (String) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestEnvironmentContext.description", reqArgs); + public TestRedisResource withPipelineStepFactory(String stepName, AspireAction1 callback) { + return withPipelineStepFactory(stepName, callback, null); } - /** Sets the Description property */ - public TestEnvironmentContext setDescription(String value) { + /** Adds a pipeline step to the resource */ + private TestRedisResource withPipelineStepFactoryImpl(String stepName, AspireAction1 callback, String[] dependsOn, String[] requiredBy, String[] tags, String description) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (TestEnvironmentContext) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestEnvironmentContext.setDescription", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("stepName", AspireClient.serializeValue(stepName)); + var callbackId = getClient().registerCallback(args -> { + var arg = (PipelineStepContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + if (dependsOn != null) { + reqArgs.put("dependsOn", AspireClient.serializeValue(dependsOn)); + } + if (requiredBy != null) { + reqArgs.put("requiredBy", AspireClient.serializeValue(requiredBy)); + } + if (tags != null) { + reqArgs.put("tags", AspireClient.serializeValue(tags)); + } + if (description != null) { + reqArgs.put("description", AspireClient.serializeValue(description)); + } + getClient().invokeCapability("Aspire.Hosting/withPipelineStepFactory", reqArgs); + return this; } - /** Gets the Priority property */ - public double priority() { + /** Configures pipeline step dependencies via an async callback */ + public TestRedisResource withPipelineConfigurationAsync(AspireAction1 callback) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (double) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestEnvironmentContext.priority", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (PipelineConfigurationContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withPipelineConfigurationAsync", reqArgs); + return this; } - /** Sets the Priority property */ - public TestEnvironmentContext setPriority(double value) { + /** Configures pipeline step dependencies via a callback */ + public TestRedisResource withPipelineConfiguration(AspireAction1 callback) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (TestEnvironmentContext) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestEnvironmentContext.setPriority", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var obj = (PipelineConfigurationContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withPipelineConfiguration", reqArgs); + return this; } -} - -/** Wrapper for Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestRedisResource. */ -class TestRedisResource extends ResourceBuilderBase { - TestRedisResource(Handle handle, AspireClient client) { - super(handle, client); + /** Adds a volume */ + public TestRedisResource withVolume(String target, WithVolumeOptions options) { + var name = options == null ? null : options.getName(); + var isReadOnly = options == null ? null : options.isReadOnly(); + return withVolumeImpl(target, name, isReadOnly); } - /** Configures a resource to use a container registry */ - public IResource withContainerRegistry(IResource registry) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("registry", AspireClient.serializeValue(registry)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withContainerRegistry", reqArgs); + public TestRedisResource withVolume(String target) { + return withVolume(target, null); } - /** Adds a bind mount */ - public ContainerResource withBindMount(String source, String target, Boolean isReadOnly) { + /** Adds a volume */ + private TestRedisResource withVolumeImpl(String target, String name, Boolean isReadOnly) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("source", AspireClient.serializeValue(source)); + reqArgs.put("resource", AspireClient.serializeValue(getHandle())); reqArgs.put("target", AspireClient.serializeValue(target)); + if (name != null) { + reqArgs.put("name", AspireClient.serializeValue(name)); + } if (isReadOnly != null) { reqArgs.put("isReadOnly", AspireClient.serializeValue(isReadOnly)); } - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withBindMount", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withVolume", reqArgs); + return this; } - /** Sets the container entrypoint */ - public ContainerResource withEntrypoint(String entrypoint) { + /** Gets the resource name */ + public String getResourceName() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("entrypoint", AspireClient.serializeValue(entrypoint)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withEntrypoint", reqArgs); + reqArgs.put("resource", AspireClient.serializeValue(getHandle())); + return (String) getClient().invokeCapability("Aspire.Hosting/getResourceName", reqArgs); } - /** Sets the container image tag */ - public ContainerResource withImageTag(String tag) { + /** Subscribes to the BeforeResourceStarted event */ + public TestRedisResource onBeforeResourceStarted(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("tag", AspireClient.serializeValue(tag)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withImageTag", reqArgs); + var callbackId = getClient().registerCallback(args -> { + var arg = (BeforeResourceStartedEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onBeforeResourceStarted", reqArgs); + return this; } - /** Sets the container image registry */ - public ContainerResource withImageRegistry(String registry) { + /** Subscribes to the ResourceStopped event */ + public TestRedisResource onResourceStopped(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("registry", AspireClient.serializeValue(registry)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withImageRegistry", reqArgs); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceStoppedEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onResourceStopped", reqArgs); + return this; } - /** Sets the container image */ - public ContainerResource withImage(String image, String tag) { + /** Subscribes to the ConnectionStringAvailable event */ + public TestRedisResource onConnectionStringAvailable(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("image", AspireClient.serializeValue(image)); - if (tag != null) { - reqArgs.put("tag", AspireClient.serializeValue(tag)); + var callbackId = getClient().registerCallback(args -> { + var arg = (ConnectionStringAvailableEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withImage", reqArgs); + getClient().invokeCapability("Aspire.Hosting/onConnectionStringAvailable", reqArgs); + return this; } - /** Sets the image SHA256 digest */ - public ContainerResource withImageSHA256(String sha256) { + /** Subscribes to the InitializeResource event */ + public TestRedisResource onInitializeResource(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("sha256", AspireClient.serializeValue(sha256)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withImageSHA256", reqArgs); + var callbackId = getClient().registerCallback(args -> { + var arg = (InitializeResourceEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onInitializeResource", reqArgs); + return this; } - /** Adds runtime arguments for the container */ - public ContainerResource withContainerRuntimeArgs(String[] args) { + /** Subscribes to the ResourceEndpointsAllocated event */ + public TestRedisResource onResourceEndpointsAllocated(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("args", AspireClient.serializeValue(args)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withContainerRuntimeArgs", reqArgs); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceEndpointsAllocatedEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onResourceEndpointsAllocated", reqArgs); + return this; } - /** Sets the lifetime behavior of the container resource */ - public ContainerResource withLifetime(ContainerLifetime lifetime) { + /** Subscribes to the ResourceReady event */ + public TestRedisResource onResourceReady(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("lifetime", AspireClient.serializeValue(lifetime)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withLifetime", reqArgs); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceReadyEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onResourceReady", reqArgs); + return this; } - /** Sets the container image pull policy */ - public ContainerResource withImagePullPolicy(ImagePullPolicy pullPolicy) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("pullPolicy", AspireClient.serializeValue(pullPolicy)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withImagePullPolicy", reqArgs); + public TestDatabaseResource addTestChildDatabase(String name) { + return addTestChildDatabase(name, null); } - /** Configures the resource to be published as a container */ - public ContainerResource publishAsContainer() { + /** Adds a child database to a test Redis resource */ + public TestDatabaseResource addTestChildDatabase(String name, String databaseName) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/publishAsContainer", reqArgs); + reqArgs.put("name", AspireClient.serializeValue(name)); + if (databaseName != null) { + reqArgs.put("databaseName", AspireClient.serializeValue(databaseName)); + } + return (TestDatabaseResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/addTestChildDatabase", reqArgs); } - /** Configures the resource to use a Dockerfile */ - public ContainerResource withDockerfile(String contextPath, String dockerfilePath, String stage) { + public TestRedisResource withPersistence() { + return withPersistence(null); + } + + /** Configures the Redis resource with persistence */ + public TestRedisResource withPersistence(TestPersistenceMode mode) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("contextPath", AspireClient.serializeValue(contextPath)); - if (dockerfilePath != null) { - reqArgs.put("dockerfilePath", AspireClient.serializeValue(dockerfilePath)); - } - if (stage != null) { - reqArgs.put("stage", AspireClient.serializeValue(stage)); + if (mode != null) { + reqArgs.put("mode", AspireClient.serializeValue(mode)); } - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withDockerfile", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withPersistence", reqArgs); + return this; } - /** Sets the container name */ - public ContainerResource withContainerName(String name) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withContainerName", reqArgs); + /** Adds an optional string parameter */ + public TestRedisResource withOptionalString(WithOptionalStringOptions options) { + var value = options == null ? null : options.getValue(); + var enabled = options == null ? null : options.getEnabled(); + return withOptionalStringImpl(value, enabled); } - /** Adds a build argument from a parameter resource */ - public ContainerResource withBuildArg(String name, ParameterResource value) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withBuildArg", reqArgs); + public TestRedisResource withOptionalString() { + return withOptionalString(null); } - /** Adds a build secret from a parameter resource */ - public ContainerResource withBuildSecret(String name, ParameterResource value) { + /** Adds an optional string parameter */ + private TestRedisResource withOptionalStringImpl(String value, Boolean enabled) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withBuildSecret", reqArgs); + if (value != null) { + reqArgs.put("value", AspireClient.serializeValue(value)); + } + if (enabled != null) { + reqArgs.put("enabled", AspireClient.serializeValue(enabled)); + } + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalString", reqArgs); + return this; } - /** Configures endpoint proxy support */ - public ContainerResource withEndpointProxySupport(boolean proxyEnabled) { + /** Configures the resource with a DTO */ + public TestRedisResource withConfig(TestConfigDto config) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("proxyEnabled", AspireClient.serializeValue(proxyEnabled)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withEndpointProxySupport", reqArgs); + reqArgs.put("config", AspireClient.serializeValue(config)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConfig", reqArgs); + return this; } - /** Sets the base image for a Dockerfile build */ - public IResource withDockerfileBaseImage(String buildImage, String runtimeImage) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (buildImage != null) { - reqArgs.put("buildImage", AspireClient.serializeValue(buildImage)); + /** Gets the tags for the resource */ + private AspireList getTagsField; + public AspireList getTags() { + if (getTagsField == null) { + getTagsField = new AspireList<>(getHandle(), getClient(), "Aspire.Hosting.CodeGeneration.Java.Tests/getTags"); } - if (runtimeImage != null) { - reqArgs.put("runtimeImage", AspireClient.serializeValue(runtimeImage)); + return getTagsField; + } + + /** Gets the metadata for the resource */ + private AspireDict getMetadataField; + public AspireDict getMetadata() { + if (getMetadataField == null) { + getMetadataField = new AspireDict<>(getHandle(), getClient(), "Aspire.Hosting.CodeGeneration.Java.Tests/getMetadata"); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withDockerfileBaseImage", reqArgs); + return getMetadataField; } - /** Adds a network alias for the container */ - public ContainerResource withContainerNetworkAlias(String alias) { + /** Sets the connection string using a reference expression */ + public TestRedisResource withConnectionString(ReferenceExpression connectionString) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("alias", AspireClient.serializeValue(alias)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withContainerNetworkAlias", reqArgs); + reqArgs.put("connectionString", AspireClient.serializeValue(connectionString)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConnectionString", reqArgs); + return this; } - /** Configures an MCP server endpoint on the resource */ - public IResourceWithEndpoints withMcpServer(String path, String endpointName) { + /** Configures environment with callback (test version) */ + public TestRedisResource testWithEnvironmentCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (path != null) { - reqArgs.put("path", AspireClient.serializeValue(path)); - } - if (endpointName != null) { - reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + var callbackId = getClient().registerCallback(args -> { + var arg = (TestEnvironmentContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withMcpServer", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWithEnvironmentCallback", reqArgs); + return this; } - /** Configures OTLP telemetry export */ - public IResourceWithEnvironment withOtlpExporter() { + /** Sets the created timestamp */ + public TestRedisResource withCreatedAt(String createdAt) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withOtlpExporter", reqArgs); + reqArgs.put("createdAt", AspireClient.serializeValue(createdAt)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCreatedAt", reqArgs); + return this; } - /** Configures OTLP telemetry export with specific protocol */ - public IResourceWithEnvironment withOtlpExporterProtocol(OtlpProtocol protocol) { + /** Sets the modified timestamp */ + public TestRedisResource withModifiedAt(String modifiedAt) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("protocol", AspireClient.serializeValue(protocol)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withOtlpExporterProtocol", reqArgs); + reqArgs.put("modifiedAt", AspireClient.serializeValue(modifiedAt)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withModifiedAt", reqArgs); + return this; } - /** Publishes the resource as a connection string */ - public ContainerResource publishAsConnectionString() { + /** Sets the correlation ID */ + public TestRedisResource withCorrelationId(String correlationId) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/publishAsConnectionString", reqArgs); + reqArgs.put("correlationId", AspireClient.serializeValue(correlationId)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCorrelationId", reqArgs); + return this; } - /** Adds a required command dependency */ - public IResource withRequiredCommand(String command, String helpLink) { + public TestRedisResource withOptionalCallback() { + return withOptionalCallback(null); + } + + /** Configures with optional callback */ + public TestRedisResource withOptionalCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("command", AspireClient.serializeValue(command)); - if (helpLink != null) { - reqArgs.put("helpLink", AspireClient.serializeValue(helpLink)); + var callbackId = callback == null ? null : getClient().registerCallback(args -> { + var arg = (TestCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withRequiredCommand", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalCallback", reqArgs); + return this; } - /** Sets an environment variable */ - public IResourceWithEnvironment withEnvironment(String name, String value) { + /** Sets the resource status */ + public TestRedisResource withStatus(TestResourceStatus status) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironment", reqArgs); + reqArgs.put("status", AspireClient.serializeValue(status)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withStatus", reqArgs); + return this; } - /** Adds an environment variable with a reference expression */ - public IResourceWithEnvironment withEnvironmentExpression(String name, ReferenceExpression value) { + /** Configures with nested DTO */ + public TestRedisResource withNestedConfig(TestNestedDto config) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentExpression", reqArgs); + reqArgs.put("config", AspireClient.serializeValue(config)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withNestedConfig", reqArgs); + return this; } - /** Sets environment variables via callback */ - public IResourceWithEnvironment withEnvironmentCallback(Function callback) { + /** Adds validation callback */ + public TestRedisResource withValidator(AspireFunc1 validator) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var validatorId = getClient().registerCallback(args -> { + var arg = (TestResourceContext) args[0]; + return AspireClient.awaitValue(validator.invoke(arg)); + }); + if (validatorId != null) { + reqArgs.put("validator", validatorId); } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentCallback", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withValidator", reqArgs); + return this; } - /** Sets environment variables via async callback */ - public IResourceWithEnvironment withEnvironmentCallbackAsync(Function callback) { + /** Waits for another resource (test version) */ + public TestRedisResource testWaitFor(IResource dependency) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentCallbackAsync", reqArgs); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWaitFor", reqArgs); + return this; } - /** Sets an environment variable from an endpoint reference */ - public IResourceWithEnvironment withEnvironmentEndpoint(String name, EndpointReference endpointReference) { + public TestRedisResource testWaitFor(ResourceBuilderBase dependency) { + return testWaitFor(new IResource(dependency.getHandle(), dependency.getClient())); + } + + /** Gets the endpoints */ + public String[] getEndpoints() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("endpointReference", AspireClient.serializeValue(endpointReference)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentEndpoint", reqArgs); + return (String[]) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/getEndpoints", reqArgs); } - /** Sets an environment variable from a parameter resource */ - public IResourceWithEnvironment withEnvironmentParameter(String name, ParameterResource parameter) { + /** Sets connection string using direct interface target */ + public TestRedisResource withConnectionStringDirect(String connectionString) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("parameter", AspireClient.serializeValue(parameter)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentParameter", reqArgs); + reqArgs.put("connectionString", AspireClient.serializeValue(connectionString)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConnectionStringDirect", reqArgs); + return this; } - /** Sets an environment variable from a connection string resource */ - public IResourceWithEnvironment withEnvironmentConnectionString(String envVarName, IResourceWithConnectionString resource) { + /** Redis-specific configuration */ + public TestRedisResource withRedisSpecific(String option) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("envVarName", AspireClient.serializeValue(envVarName)); - reqArgs.put("resource", AspireClient.serializeValue(resource)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentConnectionString", reqArgs); + reqArgs.put("option", AspireClient.serializeValue(option)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withRedisSpecific", reqArgs); + return this; } - /** Adds a connection property with a reference expression */ - public IResourceWithConnectionString withConnectionProperty(String name, ReferenceExpression value) { + /** Adds a dependency on another resource */ + public TestRedisResource withDependency(IResourceWithConnectionString dependency) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (IResourceWithConnectionString) getClient().invokeCapability("Aspire.Hosting/withConnectionProperty", reqArgs); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDependency", reqArgs); + return this; } - /** Adds a connection property with a string value */ - public IResourceWithConnectionString withConnectionPropertyValue(String name, String value) { + public TestRedisResource withDependency(ResourceBuilderBase dependency) { + return withDependency(new IResourceWithConnectionString(dependency.getHandle(), dependency.getClient())); + } + + /** Sets the endpoints */ + public TestRedisResource withEndpoints(String[] endpoints) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (IResourceWithConnectionString) getClient().invokeCapability("Aspire.Hosting/withConnectionPropertyValue", reqArgs); + reqArgs.put("endpoints", AspireClient.serializeValue(endpoints)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEndpoints", reqArgs); + return this; } - /** Adds arguments */ - public IResourceWithArgs withArgs(String[] args) { + /** Sets environment variables */ + public TestRedisResource withEnvironmentVariables(Map variables) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("args", AspireClient.serializeValue(args)); - return (IResourceWithArgs) getClient().invokeCapability("Aspire.Hosting/withArgs", reqArgs); + reqArgs.put("variables", AspireClient.serializeValue(variables)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEnvironmentVariables", reqArgs); + return this; } - /** Sets command-line arguments via callback */ - public IResourceWithArgs withArgsCallback(Function callback) { + public String getStatusAsync() { + return getStatusAsync(null); + } + + /** Gets the status of the resource asynchronously */ + public String getStatusAsync(CancellationToken cancellationToken) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + if (cancellationToken != null) { + reqArgs.put("cancellationToken", getClient().registerCancellation(cancellationToken)); } - return (IResourceWithArgs) getClient().invokeCapability("Aspire.Hosting/withArgsCallback", reqArgs); + return (String) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/getStatusAsync", reqArgs); } - /** Sets command-line arguments via async callback */ - public IResourceWithArgs withArgsCallbackAsync(Function callback) { + /** Performs a cancellable operation */ + public TestRedisResource withCancellableOperation(AspireAction1 operation) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var operationId = getClient().registerCallback(args -> { + var arg = CancellationToken.fromValue(args[0]); + operation.invoke(arg); + return null; + }); + if (operationId != null) { + reqArgs.put("operation", operationId); } - return (IResourceWithArgs) getClient().invokeCapability("Aspire.Hosting/withArgsCallbackAsync", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCancellableOperation", reqArgs); + return this; } - /** Adds a reference to another resource */ - public IResourceWithEnvironment withReference(IResource source, String connectionName, Boolean optional, String name) { + public boolean waitForReadyAsync(double timeout) { + return waitForReadyAsync(timeout, null); + } + + /** Waits for the resource to be ready */ + public boolean waitForReadyAsync(double timeout, CancellationToken cancellationToken) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("source", AspireClient.serializeValue(source)); - if (connectionName != null) { - reqArgs.put("connectionName", AspireClient.serializeValue(connectionName)); - } - if (optional != null) { - reqArgs.put("optional", AspireClient.serializeValue(optional)); - } - if (name != null) { - reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("timeout", AspireClient.serializeValue(timeout)); + if (cancellationToken != null) { + reqArgs.put("cancellationToken", getClient().registerCancellation(cancellationToken)); } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withReference", reqArgs); + return (boolean) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/waitForReadyAsync", reqArgs); } - /** Adds a reference to a URI */ - public IResourceWithEnvironment withReferenceUri(String name, String uri) { + /** Tests multi-param callback destructuring */ + public TestRedisResource withMultiParamHandleCallback(AspireAction2 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("uri", AspireClient.serializeValue(uri)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withReferenceUri", reqArgs); + var callbackId = getClient().registerCallback(args -> { + var arg1 = (TestCallbackContext) args[0]; + var arg2 = (TestEnvironmentContext) args[1]; + callback.invoke(arg1, arg2); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withMultiParamHandleCallback", reqArgs); + return this; } - /** Adds a reference to an external service */ - public IResourceWithEnvironment withReferenceExternalService(ExternalServiceResource externalService) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("externalService", AspireClient.serializeValue(externalService)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withReferenceExternalService", reqArgs); + /** Adds a data volume with persistence */ + public TestRedisResource withDataVolume(WithDataVolumeOptions options) { + var name = options == null ? null : options.getName(); + var isReadOnly = options == null ? null : options.isReadOnly(); + return withDataVolumeImpl(name, isReadOnly); } - /** Adds a reference to an endpoint */ - public IResourceWithEnvironment withReferenceEndpoint(EndpointReference endpointReference) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("endpointReference", AspireClient.serializeValue(endpointReference)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withReferenceEndpoint", reqArgs); + public TestRedisResource withDataVolume() { + return withDataVolume(null); } - /** Adds a network endpoint */ - public IResourceWithEndpoints withEndpoint(Double port, Double targetPort, String scheme, String name, String env, Boolean isProxied, Boolean isExternal, ProtocolType protocol) { + /** Adds a data volume with persistence */ + private TestRedisResource withDataVolumeImpl(String name, Boolean isReadOnly) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (port != null) { - reqArgs.put("port", AspireClient.serializeValue(port)); - } - if (targetPort != null) { - reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); - } - if (scheme != null) { - reqArgs.put("scheme", AspireClient.serializeValue(scheme)); - } if (name != null) { reqArgs.put("name", AspireClient.serializeValue(name)); } - if (env != null) { - reqArgs.put("env", AspireClient.serializeValue(env)); - } - if (isProxied != null) { - reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); - } - if (isExternal != null) { - reqArgs.put("isExternal", AspireClient.serializeValue(isExternal)); - } - if (protocol != null) { - reqArgs.put("protocol", AspireClient.serializeValue(protocol)); + if (isReadOnly != null) { + reqArgs.put("isReadOnly", AspireClient.serializeValue(isReadOnly)); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withEndpoint", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDataVolume", reqArgs); + return this; } - /** Adds an HTTP endpoint */ - public IResourceWithEndpoints withHttpEndpoint(Double port, Double targetPort, String name, String env, Boolean isProxied) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (port != null) { - reqArgs.put("port", AspireClient.serializeValue(port)); - } - if (targetPort != null) { - reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); - } - if (name != null) { - reqArgs.put("name", AspireClient.serializeValue(name)); - } - if (env != null) { - reqArgs.put("env", AspireClient.serializeValue(env)); - } - if (isProxied != null) { - reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); - } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withHttpEndpoint", reqArgs); +} + +// ===== TestResourceContext.java ===== +// TestResourceContext.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestResourceContext. */ +public class TestResourceContext extends HandleWrapperBase { + TestResourceContext(Handle handle, AspireClient client) { + super(handle, client); } - /** Adds an HTTPS endpoint */ - public IResourceWithEndpoints withHttpsEndpoint(Double port, Double targetPort, String name, String env, Boolean isProxied) { + /** Gets the Name property */ + public String name() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (port != null) { - reqArgs.put("port", AspireClient.serializeValue(port)); - } - if (targetPort != null) { - reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); - } - if (name != null) { - reqArgs.put("name", AspireClient.serializeValue(name)); - } - if (env != null) { - reqArgs.put("env", AspireClient.serializeValue(env)); - } - if (isProxied != null) { - reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); - } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withHttpsEndpoint", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (String) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestResourceContext.name", reqArgs); } - /** Makes HTTP endpoints externally accessible */ - public IResourceWithEndpoints withExternalHttpEndpoints() { + /** Sets the Name property */ + public TestResourceContext setName(String value) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withExternalHttpEndpoints", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + reqArgs.put("value", AspireClient.serializeValue(value)); + return (TestResourceContext) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestResourceContext.setName", reqArgs); } - /** Gets an endpoint reference */ - public EndpointReference getEndpoint(String name) { + /** Gets the Value property */ + public double value() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - return (EndpointReference) getClient().invokeCapability("Aspire.Hosting/getEndpoint", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (double) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestResourceContext.value", reqArgs); } - /** Configures resource for HTTP/2 */ - public IResourceWithEndpoints asHttp2Service() { + /** Sets the Value property */ + public TestResourceContext setValue(double value) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/asHttp2Service", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + reqArgs.put("value", AspireClient.serializeValue(value)); + return (TestResourceContext) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestResourceContext.setValue", reqArgs); } - /** Customizes displayed URLs via callback */ - public IResource withUrlsCallback(Function callback) { + /** Invokes the GetValueAsync method */ + public String getValueAsync() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlsCallback", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (String) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestResourceContext.getValueAsync", reqArgs); } - /** Customizes displayed URLs via async callback */ - public IResource withUrlsCallbackAsync(Function callback) { + /** Invokes the SetValueAsync method */ + public void setValueAsync(String value) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlsCallbackAsync", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + reqArgs.put("value", AspireClient.serializeValue(value)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestResourceContext.setValueAsync", reqArgs); } - /** Adds or modifies displayed URLs */ - public IResource withUrl(String url, String displayText) { + /** Invokes the ValidateAsync method */ + public boolean validateAsync() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("url", AspireClient.serializeValue(url)); - if (displayText != null) { - reqArgs.put("displayText", AspireClient.serializeValue(displayText)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrl", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (boolean) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestResourceContext.validateAsync", reqArgs); } - /** Adds a URL using a reference expression */ - public IResource withUrlExpression(ReferenceExpression url, String displayText) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("url", AspireClient.serializeValue(url)); - if (displayText != null) { - reqArgs.put("displayText", AspireClient.serializeValue(displayText)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlExpression", reqArgs); +} + +// ===== TestResourceStatus.java ===== +// TestResourceStatus.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** TestResourceStatus enum. */ +public enum TestResourceStatus implements WireValueEnum { + PENDING("Pending"), + RUNNING("Running"), + STOPPED("Stopped"), + FAILED("Failed"); + + private final String value; + + TestResourceStatus(String value) { + this.value = value; } - /** Customizes the URL for a specific endpoint via callback */ - public IResource withUrlForEndpoint(String endpointName, Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlForEndpoint", reqArgs); - } + public String getValue() { return value; } - /** Adds a URL for a specific endpoint via factory callback */ - public IResourceWithEndpoints withUrlForEndpointFactory(String endpointName, Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + public static TestResourceStatus fromValue(String value) { + for (TestResourceStatus e : values()) { + if (e.value.equals(value)) return e; } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withUrlForEndpointFactory", reqArgs); + throw new IllegalArgumentException("Unknown value: " + value); } +} - /** Excludes the resource from the deployment manifest */ - public IResource excludeFromManifest() { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/excludeFromManifest", reqArgs); +// ===== TestVaultResource.java ===== +// TestVaultResource.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestVaultResource. */ +public class TestVaultResource extends ResourceBuilderBase { + TestVaultResource(Handle handle, AspireClient client) { + super(handle, client); } - /** Waits for another resource to be ready */ - public IResourceWithWaitSupport waitFor(IResource dependency) { + /** Configures a resource to use a container registry */ + public TestVaultResource withContainerRegistry(IResource registry) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitFor", reqArgs); + reqArgs.put("registry", AspireClient.serializeValue(registry)); + getClient().invokeCapability("Aspire.Hosting/withContainerRegistry", reqArgs); + return this; } - /** Waits for another resource with specific behavior */ - public IResourceWithWaitSupport waitForWithBehavior(IResource dependency, WaitBehavior waitBehavior) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - reqArgs.put("waitBehavior", AspireClient.serializeValue(waitBehavior)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForWithBehavior", reqArgs); + public TestVaultResource withContainerRegistry(ResourceBuilderBase registry) { + return withContainerRegistry(new IResource(registry.getHandle(), registry.getClient())); } - /** Waits for another resource to start */ - public IResourceWithWaitSupport waitForStart(IResource dependency) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForStart", reqArgs); + public TestVaultResource withBindMount(String source, String target) { + return withBindMount(source, target, null); } - /** Waits for another resource to start with specific behavior */ - public IResourceWithWaitSupport waitForStartWithBehavior(IResource dependency, WaitBehavior waitBehavior) { + /** Adds a bind mount */ + public TestVaultResource withBindMount(String source, String target, Boolean isReadOnly) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - reqArgs.put("waitBehavior", AspireClient.serializeValue(waitBehavior)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForStartWithBehavior", reqArgs); + reqArgs.put("source", AspireClient.serializeValue(source)); + reqArgs.put("target", AspireClient.serializeValue(target)); + if (isReadOnly != null) { + reqArgs.put("isReadOnly", AspireClient.serializeValue(isReadOnly)); + } + getClient().invokeCapability("Aspire.Hosting/withBindMount", reqArgs); + return this; } - /** Prevents resource from starting automatically */ - public IResource withExplicitStart() { + /** Sets the container entrypoint */ + public TestVaultResource withEntrypoint(String entrypoint) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withExplicitStart", reqArgs); + reqArgs.put("entrypoint", AspireClient.serializeValue(entrypoint)); + getClient().invokeCapability("Aspire.Hosting/withEntrypoint", reqArgs); + return this; } - /** Waits for resource completion */ - public IResourceWithWaitSupport waitForCompletion(IResource dependency, Double exitCode) { + /** Sets the container image tag */ + public TestVaultResource withImageTag(String tag) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - if (exitCode != null) { - reqArgs.put("exitCode", AspireClient.serializeValue(exitCode)); - } - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForCompletion", reqArgs); + reqArgs.put("tag", AspireClient.serializeValue(tag)); + getClient().invokeCapability("Aspire.Hosting/withImageTag", reqArgs); + return this; } - /** Adds a health check by key */ - public IResource withHealthCheck(String key) { + /** Sets the container image registry */ + public TestVaultResource withImageRegistry(String registry) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("key", AspireClient.serializeValue(key)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withHealthCheck", reqArgs); + reqArgs.put("registry", AspireClient.serializeValue(registry)); + getClient().invokeCapability("Aspire.Hosting/withImageRegistry", reqArgs); + return this; } - /** Adds an HTTP health check */ - public IResourceWithEndpoints withHttpHealthCheck(String path, Double statusCode, String endpointName) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (path != null) { - reqArgs.put("path", AspireClient.serializeValue(path)); - } - if (statusCode != null) { - reqArgs.put("statusCode", AspireClient.serializeValue(statusCode)); - } - if (endpointName != null) { - reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); - } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withHttpHealthCheck", reqArgs); + public TestVaultResource withImage(String image) { + return withImage(image, null); } - /** Adds a resource command */ - public IResource withCommand(String name, String displayName, Function executeCommand, CommandOptions commandOptions) { + /** Sets the container image */ + public TestVaultResource withImage(String image, String tag) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("displayName", AspireClient.serializeValue(displayName)); - if (executeCommand != null) { - reqArgs.put("executeCommand", getClient().registerCallback(executeCommand)); - } - if (commandOptions != null) { - reqArgs.put("commandOptions", AspireClient.serializeValue(commandOptions)); + reqArgs.put("image", AspireClient.serializeValue(image)); + if (tag != null) { + reqArgs.put("tag", AspireClient.serializeValue(tag)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withCommand", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withImage", reqArgs); + return this; } - /** Configures developer certificate trust */ - public IResourceWithEnvironment withDeveloperCertificateTrust(boolean trust) { + /** Sets the image SHA256 digest */ + public TestVaultResource withImageSHA256(String sha256) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("trust", AspireClient.serializeValue(trust)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withDeveloperCertificateTrust", reqArgs); + reqArgs.put("sha256", AspireClient.serializeValue(sha256)); + getClient().invokeCapability("Aspire.Hosting/withImageSHA256", reqArgs); + return this; } - /** Sets the certificate trust scope */ - public IResourceWithEnvironment withCertificateTrustScope(CertificateTrustScope scope) { + /** Adds runtime arguments for the container */ + public TestVaultResource withContainerRuntimeArgs(String[] args) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("scope", AspireClient.serializeValue(scope)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withCertificateTrustScope", reqArgs); + reqArgs.put("args", AspireClient.serializeValue(args)); + getClient().invokeCapability("Aspire.Hosting/withContainerRuntimeArgs", reqArgs); + return this; } - /** Configures HTTPS with a developer certificate */ - public IResourceWithEnvironment withHttpsDeveloperCertificate(ParameterResource password) { + /** Sets the lifetime behavior of the container resource */ + public TestVaultResource withLifetime(ContainerLifetime lifetime) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (password != null) { - reqArgs.put("password", AspireClient.serializeValue(password)); - } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withHttpsDeveloperCertificate", reqArgs); + reqArgs.put("lifetime", AspireClient.serializeValue(lifetime)); + getClient().invokeCapability("Aspire.Hosting/withLifetime", reqArgs); + return this; } - /** Removes HTTPS certificate configuration */ - public IResourceWithEnvironment withoutHttpsCertificate() { + /** Sets the container image pull policy */ + public TestVaultResource withImagePullPolicy(ImagePullPolicy pullPolicy) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withoutHttpsCertificate", reqArgs); + reqArgs.put("pullPolicy", AspireClient.serializeValue(pullPolicy)); + getClient().invokeCapability("Aspire.Hosting/withImagePullPolicy", reqArgs); + return this; } - /** Sets the parent relationship */ - public IResource withParentRelationship(IResource parent) { + /** Configures the resource to be published as a container */ + public TestVaultResource publishAsContainer() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("parent", AspireClient.serializeValue(parent)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withParentRelationship", reqArgs); + getClient().invokeCapability("Aspire.Hosting/publishAsContainer", reqArgs); + return this; } - /** Sets a child relationship */ - public IResource withChildRelationship(IResource child) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("child", AspireClient.serializeValue(child)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withChildRelationship", reqArgs); + /** Configures the resource to use a Dockerfile */ + public TestVaultResource withDockerfile(String contextPath, WithDockerfileOptions options) { + var dockerfilePath = options == null ? null : options.getDockerfilePath(); + var stage = options == null ? null : options.getStage(); + return withDockerfileImpl(contextPath, dockerfilePath, stage); } - /** Sets the icon for the resource */ - public IResource withIconName(String iconName, IconVariant iconVariant) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("iconName", AspireClient.serializeValue(iconName)); - if (iconVariant != null) { - reqArgs.put("iconVariant", AspireClient.serializeValue(iconVariant)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withIconName", reqArgs); + public TestVaultResource withDockerfile(String contextPath) { + return withDockerfile(contextPath, null); } - /** Adds an HTTP health probe to the resource */ - public IResourceWithEndpoints withHttpProbe(ProbeType probeType, String path, Double initialDelaySeconds, Double periodSeconds, Double timeoutSeconds, Double failureThreshold, Double successThreshold, String endpointName) { + /** Configures the resource to use a Dockerfile */ + private TestVaultResource withDockerfileImpl(String contextPath, String dockerfilePath, String stage) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("probeType", AspireClient.serializeValue(probeType)); - if (path != null) { - reqArgs.put("path", AspireClient.serializeValue(path)); - } - if (initialDelaySeconds != null) { - reqArgs.put("initialDelaySeconds", AspireClient.serializeValue(initialDelaySeconds)); - } - if (periodSeconds != null) { - reqArgs.put("periodSeconds", AspireClient.serializeValue(periodSeconds)); - } - if (timeoutSeconds != null) { - reqArgs.put("timeoutSeconds", AspireClient.serializeValue(timeoutSeconds)); - } - if (failureThreshold != null) { - reqArgs.put("failureThreshold", AspireClient.serializeValue(failureThreshold)); - } - if (successThreshold != null) { - reqArgs.put("successThreshold", AspireClient.serializeValue(successThreshold)); + reqArgs.put("contextPath", AspireClient.serializeValue(contextPath)); + if (dockerfilePath != null) { + reqArgs.put("dockerfilePath", AspireClient.serializeValue(dockerfilePath)); } - if (endpointName != null) { - reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + if (stage != null) { + reqArgs.put("stage", AspireClient.serializeValue(stage)); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withHttpProbe", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withDockerfile", reqArgs); + return this; } - /** Excludes the resource from MCP server exposure */ - public IResource excludeFromMcp() { + /** Sets the container name */ + public TestVaultResource withContainerName(String name) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/excludeFromMcp", reqArgs); + reqArgs.put("name", AspireClient.serializeValue(name)); + getClient().invokeCapability("Aspire.Hosting/withContainerName", reqArgs); + return this; } - /** Sets the remote image name for publishing */ - public IComputeResource withRemoteImageName(String remoteImageName) { + /** Adds a build argument from a parameter resource */ + public TestVaultResource withBuildArg(String name, ParameterResource value) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("remoteImageName", AspireClient.serializeValue(remoteImageName)); - return (IComputeResource) getClient().invokeCapability("Aspire.Hosting/withRemoteImageName", reqArgs); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("value", AspireClient.serializeValue(value)); + getClient().invokeCapability("Aspire.Hosting/withBuildArg", reqArgs); + return this; } - /** Sets the remote image tag for publishing */ - public IComputeResource withRemoteImageTag(String remoteImageTag) { + /** Adds a build secret from a parameter resource */ + public TestVaultResource withBuildSecret(String name, ParameterResource value) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("remoteImageTag", AspireClient.serializeValue(remoteImageTag)); - return (IComputeResource) getClient().invokeCapability("Aspire.Hosting/withRemoteImageTag", reqArgs); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("value", AspireClient.serializeValue(value)); + getClient().invokeCapability("Aspire.Hosting/withBuildSecret", reqArgs); + return this; } - /** Adds a pipeline step to the resource */ - public IResource withPipelineStepFactory(String stepName, Function callback, String[] dependsOn, String[] requiredBy, String[] tags, String description) { + /** Configures endpoint proxy support */ + public TestVaultResource withEndpointProxySupport(boolean proxyEnabled) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("stepName", AspireClient.serializeValue(stepName)); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - if (dependsOn != null) { - reqArgs.put("dependsOn", AspireClient.serializeValue(dependsOn)); - } - if (requiredBy != null) { - reqArgs.put("requiredBy", AspireClient.serializeValue(requiredBy)); - } - if (tags != null) { - reqArgs.put("tags", AspireClient.serializeValue(tags)); - } - if (description != null) { - reqArgs.put("description", AspireClient.serializeValue(description)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withPipelineStepFactory", reqArgs); + reqArgs.put("proxyEnabled", AspireClient.serializeValue(proxyEnabled)); + getClient().invokeCapability("Aspire.Hosting/withEndpointProxySupport", reqArgs); + return this; } - /** Configures pipeline step dependencies via an async callback */ - public IResource withPipelineConfigurationAsync(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withPipelineConfigurationAsync", reqArgs); + /** Sets the base image for a Dockerfile build */ + public TestVaultResource withDockerfileBaseImage(WithDockerfileBaseImageOptions options) { + var buildImage = options == null ? null : options.getBuildImage(); + var runtimeImage = options == null ? null : options.getRuntimeImage(); + return withDockerfileBaseImageImpl(buildImage, runtimeImage); } - /** Configures pipeline step dependencies via a callback */ - public IResource withPipelineConfiguration(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withPipelineConfiguration", reqArgs); + public TestVaultResource withDockerfileBaseImage() { + return withDockerfileBaseImage(null); } - /** Adds a volume */ - public ContainerResource withVolume(String target, String name, Boolean isReadOnly) { + /** Sets the base image for a Dockerfile build */ + private TestVaultResource withDockerfileBaseImageImpl(String buildImage, String runtimeImage) { Map reqArgs = new HashMap<>(); - reqArgs.put("resource", AspireClient.serializeValue(getHandle())); - reqArgs.put("target", AspireClient.serializeValue(target)); - if (name != null) { - reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + if (buildImage != null) { + reqArgs.put("buildImage", AspireClient.serializeValue(buildImage)); } - if (isReadOnly != null) { - reqArgs.put("isReadOnly", AspireClient.serializeValue(isReadOnly)); + if (runtimeImage != null) { + reqArgs.put("runtimeImage", AspireClient.serializeValue(runtimeImage)); } - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withVolume", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withDockerfileBaseImage", reqArgs); + return this; } - /** Gets the resource name */ - public String getResourceName() { + /** Adds a network alias for the container */ + public TestVaultResource withContainerNetworkAlias(String alias) { Map reqArgs = new HashMap<>(); - reqArgs.put("resource", AspireClient.serializeValue(getHandle())); - return (String) getClient().invokeCapability("Aspire.Hosting/getResourceName", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("alias", AspireClient.serializeValue(alias)); + getClient().invokeCapability("Aspire.Hosting/withContainerNetworkAlias", reqArgs); + return this; } - /** Subscribes to the BeforeResourceStarted event */ - public IResource onBeforeResourceStarted(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onBeforeResourceStarted", reqArgs); + /** Configures an MCP server endpoint on the resource */ + public TestVaultResource withMcpServer(WithMcpServerOptions options) { + var path = options == null ? null : options.getPath(); + var endpointName = options == null ? null : options.getEndpointName(); + return withMcpServerImpl(path, endpointName); } - /** Subscribes to the ResourceStopped event */ - public IResource onResourceStopped(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onResourceStopped", reqArgs); + public TestVaultResource withMcpServer() { + return withMcpServer(null); } - /** Subscribes to the ConnectionStringAvailable event */ - public IResourceWithConnectionString onConnectionStringAvailable(Function callback) { + /** Configures an MCP server endpoint on the resource */ + private TestVaultResource withMcpServerImpl(String path, String endpointName) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + if (path != null) { + reqArgs.put("path", AspireClient.serializeValue(path)); + } + if (endpointName != null) { + reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); } - return (IResourceWithConnectionString) getClient().invokeCapability("Aspire.Hosting/onConnectionStringAvailable", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withMcpServer", reqArgs); + return this; } - /** Subscribes to the InitializeResource event */ - public IResource onInitializeResource(Function callback) { + /** Configures OTLP telemetry export */ + public TestVaultResource withOtlpExporter() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onInitializeResource", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withOtlpExporter", reqArgs); + return this; } - /** Subscribes to the ResourceEndpointsAllocated event */ - public IResourceWithEndpoints onResourceEndpointsAllocated(Function callback) { + /** Configures OTLP telemetry export with specific protocol */ + public TestVaultResource withOtlpExporterProtocol(OtlpProtocol protocol) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/onResourceEndpointsAllocated", reqArgs); + reqArgs.put("protocol", AspireClient.serializeValue(protocol)); + getClient().invokeCapability("Aspire.Hosting/withOtlpExporterProtocol", reqArgs); + return this; } - /** Subscribes to the ResourceReady event */ - public IResource onResourceReady(Function callback) { + /** Publishes the resource as a connection string */ + public TestVaultResource publishAsConnectionString() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onResourceReady", reqArgs); + getClient().invokeCapability("Aspire.Hosting/publishAsConnectionString", reqArgs); + return this; } - /** Adds a child database to a test Redis resource */ - public TestDatabaseResource addTestChildDatabase(String name, String databaseName) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - if (databaseName != null) { - reqArgs.put("databaseName", AspireClient.serializeValue(databaseName)); - } - return (TestDatabaseResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/addTestChildDatabase", reqArgs); + public TestVaultResource withRequiredCommand(String command) { + return withRequiredCommand(command, null); } - /** Configures the Redis resource with persistence */ - public TestRedisResource withPersistence(TestPersistenceMode mode) { + /** Adds a required command dependency */ + public TestVaultResource withRequiredCommand(String command, String helpLink) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (mode != null) { - reqArgs.put("mode", AspireClient.serializeValue(mode)); + reqArgs.put("command", AspireClient.serializeValue(command)); + if (helpLink != null) { + reqArgs.put("helpLink", AspireClient.serializeValue(helpLink)); } - return (TestRedisResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withPersistence", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withRequiredCommand", reqArgs); + return this; } - /** Adds an optional string parameter */ - public IResource withOptionalString(String value, Boolean enabled) { + /** Sets an environment variable */ + public TestVaultResource withEnvironment(String name, String value) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (value != null) { - reqArgs.put("value", AspireClient.serializeValue(value)); - } - if (enabled != null) { - reqArgs.put("enabled", AspireClient.serializeValue(enabled)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalString", reqArgs); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("value", AspireClient.serializeValue(value)); + getClient().invokeCapability("Aspire.Hosting/withEnvironment", reqArgs); + return this; } - /** Configures the resource with a DTO */ - public IResource withConfig(TestConfigDto config) { + /** Adds an environment variable with a reference expression */ + public TestVaultResource withEnvironmentExpression(String name, ReferenceExpression value) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("config", AspireClient.serializeValue(config)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConfig", reqArgs); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("value", AspireClient.serializeValue(value)); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentExpression", reqArgs); + return this; } - /** Gets the tags for the resource */ - private AspireList getTagsField; - public AspireList getTags() { - if (getTagsField == null) { - getTagsField = new AspireList<>(getHandle(), getClient(), "Aspire.Hosting.CodeGeneration.Java.Tests/getTags"); + /** Sets environment variables via callback */ + public TestVaultResource withEnvironmentCallback(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var obj = (EnvironmentCallbackContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return getTagsField; + getClient().invokeCapability("Aspire.Hosting/withEnvironmentCallback", reqArgs); + return this; } - /** Gets the metadata for the resource */ - private AspireDict getMetadataField; - public AspireDict getMetadata() { - if (getMetadataField == null) { - getMetadataField = new AspireDict<>(getHandle(), getClient(), "Aspire.Hosting.CodeGeneration.Java.Tests/getMetadata"); + /** Sets environment variables via async callback */ + public TestVaultResource withEnvironmentCallbackAsync(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var arg = (EnvironmentCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return getMetadataField; + getClient().invokeCapability("Aspire.Hosting/withEnvironmentCallbackAsync", reqArgs); + return this; } - /** Sets the connection string using a reference expression */ - public IResourceWithConnectionString withConnectionString(ReferenceExpression connectionString) { + /** Sets an environment variable from an endpoint reference */ + public TestVaultResource withEnvironmentEndpoint(String name, EndpointReference endpointReference) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("connectionString", AspireClient.serializeValue(connectionString)); - return (IResourceWithConnectionString) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConnectionString", reqArgs); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("endpointReference", AspireClient.serializeValue(endpointReference)); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentEndpoint", reqArgs); + return this; } - /** Configures environment with callback (test version) */ - public IResourceWithEnvironment testWithEnvironmentCallback(Function callback) { + /** Sets an environment variable from a parameter resource */ + public TestVaultResource withEnvironmentParameter(String name, ParameterResource parameter) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWithEnvironmentCallback", reqArgs); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("parameter", AspireClient.serializeValue(parameter)); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentParameter", reqArgs); + return this; } - /** Sets the created timestamp */ - public IResource withCreatedAt(String createdAt) { + /** Sets an environment variable from a connection string resource */ + public TestVaultResource withEnvironmentConnectionString(String envVarName, IResourceWithConnectionString resource) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("createdAt", AspireClient.serializeValue(createdAt)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCreatedAt", reqArgs); + reqArgs.put("envVarName", AspireClient.serializeValue(envVarName)); + reqArgs.put("resource", AspireClient.serializeValue(resource)); + getClient().invokeCapability("Aspire.Hosting/withEnvironmentConnectionString", reqArgs); + return this; } - /** Sets the modified timestamp */ - public IResource withModifiedAt(String modifiedAt) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("modifiedAt", AspireClient.serializeValue(modifiedAt)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withModifiedAt", reqArgs); + public TestVaultResource withEnvironmentConnectionString(String envVarName, ResourceBuilderBase resource) { + return withEnvironmentConnectionString(envVarName, new IResourceWithConnectionString(resource.getHandle(), resource.getClient())); } - /** Sets the correlation ID */ - public IResource withCorrelationId(String correlationId) { + /** Adds arguments */ + public TestVaultResource withArgs(String[] args) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("correlationId", AspireClient.serializeValue(correlationId)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCorrelationId", reqArgs); + reqArgs.put("args", AspireClient.serializeValue(args)); + getClient().invokeCapability("Aspire.Hosting/withArgs", reqArgs); + return this; } - /** Configures with optional callback */ - public IResource withOptionalCallback(Function callback) { + /** Sets command-line arguments via callback */ + public TestVaultResource withArgsCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var obj = (CommandLineArgsCallbackContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalCallback", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withArgsCallback", reqArgs); + return this; } - /** Sets the resource status */ - public IResource withStatus(TestResourceStatus status) { + /** Sets command-line arguments via async callback */ + public TestVaultResource withArgsCallbackAsync(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("status", AspireClient.serializeValue(status)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withStatus", reqArgs); + var callbackId = getClient().registerCallback(args -> { + var arg = (CommandLineArgsCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withArgsCallbackAsync", reqArgs); + return this; } - /** Configures with nested DTO */ - public IResource withNestedConfig(TestNestedDto config) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("config", AspireClient.serializeValue(config)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withNestedConfig", reqArgs); + /** Adds a reference to another resource */ + public TestVaultResource withReference(IResource source, WithReferenceOptions options) { + var connectionName = options == null ? null : options.getConnectionName(); + var optional = options == null ? null : options.getOptional(); + var name = options == null ? null : options.getName(); + return withReferenceImpl(source, connectionName, optional, name); } - /** Adds validation callback */ - public IResource withValidator(Function validator) { + public TestVaultResource withReference(ResourceBuilderBase source, WithReferenceOptions options) { + return withReference(new IResource(source.getHandle(), source.getClient()), options); + } + + public TestVaultResource withReference(IResource source) { + return withReference(source, null); + } + + public TestVaultResource withReference(ResourceBuilderBase source) { + return withReference(new IResource(source.getHandle(), source.getClient())); + } + + /** Adds a reference to another resource */ + private TestVaultResource withReferenceImpl(IResource source, String connectionName, Boolean optional, String name) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (validator != null) { - reqArgs.put("validator", getClient().registerCallback(validator)); + reqArgs.put("source", AspireClient.serializeValue(source)); + if (connectionName != null) { + reqArgs.put("connectionName", AspireClient.serializeValue(connectionName)); + } + if (optional != null) { + reqArgs.put("optional", AspireClient.serializeValue(optional)); + } + if (name != null) { + reqArgs.put("name", AspireClient.serializeValue(name)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withValidator", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withReference", reqArgs); + return this; } - /** Waits for another resource (test version) */ - public IResource testWaitFor(IResource dependency) { + /** Adds a reference to a URI */ + public TestVaultResource withReferenceUri(String name, String uri) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWaitFor", reqArgs); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("uri", AspireClient.serializeValue(uri)); + getClient().invokeCapability("Aspire.Hosting/withReferenceUri", reqArgs); + return this; } - /** Gets the endpoints */ - public String[] getEndpoints() { + /** Adds a reference to an external service */ + public TestVaultResource withReferenceExternalService(ExternalServiceResource externalService) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (String[]) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/getEndpoints", reqArgs); + reqArgs.put("externalService", AspireClient.serializeValue(externalService)); + getClient().invokeCapability("Aspire.Hosting/withReferenceExternalService", reqArgs); + return this; } - /** Sets connection string using direct interface target */ - public IResourceWithConnectionString withConnectionStringDirect(String connectionString) { + /** Adds a reference to an endpoint */ + public TestVaultResource withReferenceEndpoint(EndpointReference endpointReference) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("connectionString", AspireClient.serializeValue(connectionString)); - return (IResourceWithConnectionString) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConnectionStringDirect", reqArgs); + reqArgs.put("endpointReference", AspireClient.serializeValue(endpointReference)); + getClient().invokeCapability("Aspire.Hosting/withReferenceEndpoint", reqArgs); + return this; } - /** Redis-specific configuration */ - public TestRedisResource withRedisSpecific(String option) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("option", AspireClient.serializeValue(option)); - return (TestRedisResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withRedisSpecific", reqArgs); + /** Adds a network endpoint */ + public TestVaultResource withEndpoint(WithEndpointOptions options) { + var port = options == null ? null : options.getPort(); + var targetPort = options == null ? null : options.getTargetPort(); + var scheme = options == null ? null : options.getScheme(); + var name = options == null ? null : options.getName(); + var env = options == null ? null : options.getEnv(); + var isProxied = options == null ? null : options.isProxied(); + var isExternal = options == null ? null : options.isExternal(); + var protocol = options == null ? null : options.getProtocol(); + return withEndpointImpl(port, targetPort, scheme, name, env, isProxied, isExternal, protocol); } - /** Adds a dependency on another resource */ - public IResource withDependency(IResourceWithConnectionString dependency) { + public TestVaultResource withEndpoint() { + return withEndpoint(null); + } + + /** Adds a network endpoint */ + private TestVaultResource withEndpointImpl(Double port, Double targetPort, String scheme, String name, String env, Boolean isProxied, Boolean isExternal, ProtocolType protocol) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDependency", reqArgs); + if (port != null) { + reqArgs.put("port", AspireClient.serializeValue(port)); + } + if (targetPort != null) { + reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); + } + if (scheme != null) { + reqArgs.put("scheme", AspireClient.serializeValue(scheme)); + } + if (name != null) { + reqArgs.put("name", AspireClient.serializeValue(name)); + } + if (env != null) { + reqArgs.put("env", AspireClient.serializeValue(env)); + } + if (isProxied != null) { + reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); + } + if (isExternal != null) { + reqArgs.put("isExternal", AspireClient.serializeValue(isExternal)); + } + if (protocol != null) { + reqArgs.put("protocol", AspireClient.serializeValue(protocol)); + } + getClient().invokeCapability("Aspire.Hosting/withEndpoint", reqArgs); + return this; } - /** Sets the endpoints */ - public IResource withEndpoints(String[] endpoints) { + /** Adds an HTTP endpoint */ + public TestVaultResource withHttpEndpoint(WithHttpEndpointOptions options) { + var port = options == null ? null : options.getPort(); + var targetPort = options == null ? null : options.getTargetPort(); + var name = options == null ? null : options.getName(); + var env = options == null ? null : options.getEnv(); + var isProxied = options == null ? null : options.isProxied(); + return withHttpEndpointImpl(port, targetPort, name, env, isProxied); + } + + public TestVaultResource withHttpEndpoint() { + return withHttpEndpoint(null); + } + + /** Adds an HTTP endpoint */ + private TestVaultResource withHttpEndpointImpl(Double port, Double targetPort, String name, String env, Boolean isProxied) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("endpoints", AspireClient.serializeValue(endpoints)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEndpoints", reqArgs); + if (port != null) { + reqArgs.put("port", AspireClient.serializeValue(port)); + } + if (targetPort != null) { + reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); + } + if (name != null) { + reqArgs.put("name", AspireClient.serializeValue(name)); + } + if (env != null) { + reqArgs.put("env", AspireClient.serializeValue(env)); + } + if (isProxied != null) { + reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); + } + getClient().invokeCapability("Aspire.Hosting/withHttpEndpoint", reqArgs); + return this; } - /** Sets environment variables */ - public IResourceWithEnvironment withEnvironmentVariables(Map variables) { + /** Adds an HTTPS endpoint */ + public TestVaultResource withHttpsEndpoint(WithHttpsEndpointOptions options) { + var port = options == null ? null : options.getPort(); + var targetPort = options == null ? null : options.getTargetPort(); + var name = options == null ? null : options.getName(); + var env = options == null ? null : options.getEnv(); + var isProxied = options == null ? null : options.isProxied(); + return withHttpsEndpointImpl(port, targetPort, name, env, isProxied); + } + + public TestVaultResource withHttpsEndpoint() { + return withHttpsEndpoint(null); + } + + /** Adds an HTTPS endpoint */ + private TestVaultResource withHttpsEndpointImpl(Double port, Double targetPort, String name, String env, Boolean isProxied) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("variables", AspireClient.serializeValue(variables)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEnvironmentVariables", reqArgs); + if (port != null) { + reqArgs.put("port", AspireClient.serializeValue(port)); + } + if (targetPort != null) { + reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); + } + if (name != null) { + reqArgs.put("name", AspireClient.serializeValue(name)); + } + if (env != null) { + reqArgs.put("env", AspireClient.serializeValue(env)); + } + if (isProxied != null) { + reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); + } + getClient().invokeCapability("Aspire.Hosting/withHttpsEndpoint", reqArgs); + return this; } - /** Gets the status of the resource asynchronously */ - public String getStatusAsync(CancellationToken cancellationToken) { + /** Makes HTTP endpoints externally accessible */ + public TestVaultResource withExternalHttpEndpoints() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (cancellationToken != null) { - reqArgs.put("cancellationToken", getClient().registerCancellation(cancellationToken)); - } - return (String) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/getStatusAsync", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withExternalHttpEndpoints", reqArgs); + return this; } - /** Performs a cancellable operation */ - public IResource withCancellableOperation(Function operation) { + /** Gets an endpoint reference */ + public EndpointReference getEndpoint(String name) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (operation != null) { - reqArgs.put("operation", getClient().registerCallback(operation)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCancellableOperation", reqArgs); + reqArgs.put("name", AspireClient.serializeValue(name)); + return (EndpointReference) getClient().invokeCapability("Aspire.Hosting/getEndpoint", reqArgs); } - /** Waits for the resource to be ready */ - public boolean waitForReadyAsync(double timeout, CancellationToken cancellationToken) { + /** Configures resource for HTTP/2 */ + public TestVaultResource asHttp2Service() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("timeout", AspireClient.serializeValue(timeout)); - if (cancellationToken != null) { - reqArgs.put("cancellationToken", getClient().registerCancellation(cancellationToken)); - } - return (boolean) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/waitForReadyAsync", reqArgs); + getClient().invokeCapability("Aspire.Hosting/asHttp2Service", reqArgs); + return this; } - /** Tests multi-param callback destructuring */ - public TestRedisResource withMultiParamHandleCallback(Function callback) { + /** Customizes displayed URLs via callback */ + public TestVaultResource withUrlsCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var obj = (ResourceUrlsCallbackContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (TestRedisResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withMultiParamHandleCallback", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrlsCallback", reqArgs); + return this; } - /** Adds a data volume with persistence */ - public TestRedisResource withDataVolume(String name, Boolean isReadOnly) { + /** Customizes displayed URLs via async callback */ + public TestVaultResource withUrlsCallbackAsync(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (name != null) { - reqArgs.put("name", AspireClient.serializeValue(name)); - } - if (isReadOnly != null) { - reqArgs.put("isReadOnly", AspireClient.serializeValue(isReadOnly)); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceUrlsCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (TestRedisResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDataVolume", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withUrlsCallbackAsync", reqArgs); + return this; } -} - -/** Wrapper for Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestResourceContext. */ -class TestResourceContext extends HandleWrapperBase { - TestResourceContext(Handle handle, AspireClient client) { - super(handle, client); + public TestVaultResource withUrl(String url) { + return withUrl(url, null); } - /** Gets the Name property */ - public String name() { + /** Adds or modifies displayed URLs */ + public TestVaultResource withUrl(String url, String displayText) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (String) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestResourceContext.name", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("url", AspireClient.serializeValue(url)); + if (displayText != null) { + reqArgs.put("displayText", AspireClient.serializeValue(displayText)); + } + getClient().invokeCapability("Aspire.Hosting/withUrl", reqArgs); + return this; } - /** Sets the Name property */ - public TestResourceContext setName(String value) { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (TestResourceContext) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestResourceContext.setName", reqArgs); + public TestVaultResource withUrlExpression(ReferenceExpression url) { + return withUrlExpression(url, null); } - /** Gets the Value property */ - public double value() { + /** Adds a URL using a reference expression */ + public TestVaultResource withUrlExpression(ReferenceExpression url, String displayText) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (double) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestResourceContext.value", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("url", AspireClient.serializeValue(url)); + if (displayText != null) { + reqArgs.put("displayText", AspireClient.serializeValue(displayText)); + } + getClient().invokeCapability("Aspire.Hosting/withUrlExpression", reqArgs); + return this; } - /** Sets the Value property */ - public TestResourceContext setValue(double value) { + /** Customizes the URL for a specific endpoint via callback */ + public TestVaultResource withUrlForEndpoint(String endpointName, AspireAction1 callback) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (TestResourceContext) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestResourceContext.setValue", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + var callbackId = getClient().registerCallback(args -> { + var obj = (ResourceUrlAnnotation) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withUrlForEndpoint", reqArgs); + return this; } - /** Invokes the GetValueAsync method */ - public String getValueAsync() { + /** Adds a URL for a specific endpoint via factory callback */ + public TestVaultResource withUrlForEndpointFactory(String endpointName, AspireFunc1 callback) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (String) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestResourceContext.getValueAsync", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + var callbackId = getClient().registerCallback(args -> { + var arg = (EndpointReference) args[0]; + return AspireClient.awaitValue(callback.invoke(arg)); + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withUrlForEndpointFactory", reqArgs); + return this; } - /** Invokes the SetValueAsync method */ - public void setValueAsync(String value) { + /** Excludes the resource from the deployment manifest */ + public TestVaultResource excludeFromManifest() { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - reqArgs.put("value", AspireClient.serializeValue(value)); - getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestResourceContext.setValueAsync", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + getClient().invokeCapability("Aspire.Hosting/excludeFromManifest", reqArgs); + return this; } - /** Invokes the ValidateAsync method */ - public boolean validateAsync() { + /** Waits for another resource to be ready */ + public TestVaultResource waitFor(IResource dependency) { Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (boolean) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes/TestResourceContext.validateAsync", reqArgs); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + getClient().invokeCapability("Aspire.Hosting/waitFor", reqArgs); + return this; } -} - -/** Wrapper for Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestVaultResource. */ -class TestVaultResource extends ResourceBuilderBase { - TestVaultResource(Handle handle, AspireClient client) { - super(handle, client); + public TestVaultResource waitFor(ResourceBuilderBase dependency) { + return waitFor(new IResource(dependency.getHandle(), dependency.getClient())); } - /** Configures a resource to use a container registry */ - public IResource withContainerRegistry(IResource registry) { + /** Waits for another resource with specific behavior */ + public TestVaultResource waitForWithBehavior(IResource dependency, WaitBehavior waitBehavior) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("registry", AspireClient.serializeValue(registry)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withContainerRegistry", reqArgs); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + reqArgs.put("waitBehavior", AspireClient.serializeValue(waitBehavior)); + getClient().invokeCapability("Aspire.Hosting/waitForWithBehavior", reqArgs); + return this; } - /** Adds a bind mount */ - public ContainerResource withBindMount(String source, String target, Boolean isReadOnly) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("source", AspireClient.serializeValue(source)); - reqArgs.put("target", AspireClient.serializeValue(target)); - if (isReadOnly != null) { - reqArgs.put("isReadOnly", AspireClient.serializeValue(isReadOnly)); - } - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withBindMount", reqArgs); + public TestVaultResource waitForWithBehavior(ResourceBuilderBase dependency, WaitBehavior waitBehavior) { + return waitForWithBehavior(new IResource(dependency.getHandle(), dependency.getClient()), waitBehavior); } - /** Sets the container entrypoint */ - public ContainerResource withEntrypoint(String entrypoint) { + /** Waits for another resource to start */ + public TestVaultResource waitForStart(IResource dependency) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("entrypoint", AspireClient.serializeValue(entrypoint)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withEntrypoint", reqArgs); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + getClient().invokeCapability("Aspire.Hosting/waitForStart", reqArgs); + return this; } - /** Sets the container image tag */ - public ContainerResource withImageTag(String tag) { + public TestVaultResource waitForStart(ResourceBuilderBase dependency) { + return waitForStart(new IResource(dependency.getHandle(), dependency.getClient())); + } + + /** Waits for another resource to start with specific behavior */ + public TestVaultResource waitForStartWithBehavior(IResource dependency, WaitBehavior waitBehavior) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("tag", AspireClient.serializeValue(tag)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withImageTag", reqArgs); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + reqArgs.put("waitBehavior", AspireClient.serializeValue(waitBehavior)); + getClient().invokeCapability("Aspire.Hosting/waitForStartWithBehavior", reqArgs); + return this; } - /** Sets the container image registry */ - public ContainerResource withImageRegistry(String registry) { + public TestVaultResource waitForStartWithBehavior(ResourceBuilderBase dependency, WaitBehavior waitBehavior) { + return waitForStartWithBehavior(new IResource(dependency.getHandle(), dependency.getClient()), waitBehavior); + } + + /** Prevents resource from starting automatically */ + public TestVaultResource withExplicitStart() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("registry", AspireClient.serializeValue(registry)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withImageRegistry", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withExplicitStart", reqArgs); + return this; } - /** Sets the container image */ - public ContainerResource withImage(String image, String tag) { + public TestVaultResource waitForCompletion(IResource dependency) { + return waitForCompletion(dependency, null); + } + + public TestVaultResource waitForCompletion(ResourceBuilderBase dependency) { + return waitForCompletion(new IResource(dependency.getHandle(), dependency.getClient())); + } + + /** Waits for resource completion */ + public TestVaultResource waitForCompletion(IResource dependency, Double exitCode) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("image", AspireClient.serializeValue(image)); - if (tag != null) { - reqArgs.put("tag", AspireClient.serializeValue(tag)); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + if (exitCode != null) { + reqArgs.put("exitCode", AspireClient.serializeValue(exitCode)); } - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withImage", reqArgs); + getClient().invokeCapability("Aspire.Hosting/waitForCompletion", reqArgs); + return this; } - /** Sets the image SHA256 digest */ - public ContainerResource withImageSHA256(String sha256) { + public TestVaultResource waitForCompletion(ResourceBuilderBase dependency, Double exitCode) { + return waitForCompletion(new IResource(dependency.getHandle(), dependency.getClient()), exitCode); + } + + /** Adds a health check by key */ + public TestVaultResource withHealthCheck(String key) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("sha256", AspireClient.serializeValue(sha256)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withImageSHA256", reqArgs); + reqArgs.put("key", AspireClient.serializeValue(key)); + getClient().invokeCapability("Aspire.Hosting/withHealthCheck", reqArgs); + return this; } - /** Adds runtime arguments for the container */ - public ContainerResource withContainerRuntimeArgs(String[] args) { + /** Adds an HTTP health check */ + public TestVaultResource withHttpHealthCheck(WithHttpHealthCheckOptions options) { + var path = options == null ? null : options.getPath(); + var statusCode = options == null ? null : options.getStatusCode(); + var endpointName = options == null ? null : options.getEndpointName(); + return withHttpHealthCheckImpl(path, statusCode, endpointName); + } + + public TestVaultResource withHttpHealthCheck() { + return withHttpHealthCheck(null); + } + + /** Adds an HTTP health check */ + private TestVaultResource withHttpHealthCheckImpl(String path, Double statusCode, String endpointName) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("args", AspireClient.serializeValue(args)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withContainerRuntimeArgs", reqArgs); + if (path != null) { + reqArgs.put("path", AspireClient.serializeValue(path)); + } + if (statusCode != null) { + reqArgs.put("statusCode", AspireClient.serializeValue(statusCode)); + } + if (endpointName != null) { + reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); + } + getClient().invokeCapability("Aspire.Hosting/withHttpHealthCheck", reqArgs); + return this; } - /** Sets the lifetime behavior of the container resource */ - public ContainerResource withLifetime(ContainerLifetime lifetime) { + public TestVaultResource withCommand(String name, String displayName, AspireFunc1 executeCommand) { + return withCommand(name, displayName, executeCommand, null); + } + + /** Adds a resource command */ + public TestVaultResource withCommand(String name, String displayName, AspireFunc1 executeCommand, CommandOptions commandOptions) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("lifetime", AspireClient.serializeValue(lifetime)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withLifetime", reqArgs); + reqArgs.put("name", AspireClient.serializeValue(name)); + reqArgs.put("displayName", AspireClient.serializeValue(displayName)); + var executeCommandId = getClient().registerCallback(args -> { + var arg = (ExecuteCommandContext) args[0]; + return AspireClient.awaitValue(executeCommand.invoke(arg)); + }); + if (executeCommandId != null) { + reqArgs.put("executeCommand", executeCommandId); + } + if (commandOptions != null) { + reqArgs.put("commandOptions", AspireClient.serializeValue(commandOptions)); + } + getClient().invokeCapability("Aspire.Hosting/withCommand", reqArgs); + return this; } - /** Sets the container image pull policy */ - public ContainerResource withImagePullPolicy(ImagePullPolicy pullPolicy) { + /** Configures developer certificate trust */ + public TestVaultResource withDeveloperCertificateTrust(boolean trust) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("pullPolicy", AspireClient.serializeValue(pullPolicy)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withImagePullPolicy", reqArgs); + reqArgs.put("trust", AspireClient.serializeValue(trust)); + getClient().invokeCapability("Aspire.Hosting/withDeveloperCertificateTrust", reqArgs); + return this; } - /** Configures the resource to be published as a container */ - public ContainerResource publishAsContainer() { + /** Sets the certificate trust scope */ + public TestVaultResource withCertificateTrustScope(CertificateTrustScope scope) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/publishAsContainer", reqArgs); + reqArgs.put("scope", AspireClient.serializeValue(scope)); + getClient().invokeCapability("Aspire.Hosting/withCertificateTrustScope", reqArgs); + return this; } - /** Configures the resource to use a Dockerfile */ - public ContainerResource withDockerfile(String contextPath, String dockerfilePath, String stage) { + public TestVaultResource withHttpsDeveloperCertificate() { + return withHttpsDeveloperCertificate(null); + } + + /** Configures HTTPS with a developer certificate */ + public TestVaultResource withHttpsDeveloperCertificate(ParameterResource password) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("contextPath", AspireClient.serializeValue(contextPath)); - if (dockerfilePath != null) { - reqArgs.put("dockerfilePath", AspireClient.serializeValue(dockerfilePath)); - } - if (stage != null) { - reqArgs.put("stage", AspireClient.serializeValue(stage)); + if (password != null) { + reqArgs.put("password", AspireClient.serializeValue(password)); } - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withDockerfile", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withHttpsDeveloperCertificate", reqArgs); + return this; } - /** Sets the container name */ - public ContainerResource withContainerName(String name) { + /** Removes HTTPS certificate configuration */ + public TestVaultResource withoutHttpsCertificate() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withContainerName", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withoutHttpsCertificate", reqArgs); + return this; } - /** Adds a build argument from a parameter resource */ - public ContainerResource withBuildArg(String name, ParameterResource value) { + /** Sets the parent relationship */ + public TestVaultResource withParentRelationship(IResource parent) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withBuildArg", reqArgs); + reqArgs.put("parent", AspireClient.serializeValue(parent)); + getClient().invokeCapability("Aspire.Hosting/withParentRelationship", reqArgs); + return this; } - /** Adds a build secret from a parameter resource */ - public ContainerResource withBuildSecret(String name, ParameterResource value) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withBuildSecret", reqArgs); + public TestVaultResource withParentRelationship(ResourceBuilderBase parent) { + return withParentRelationship(new IResource(parent.getHandle(), parent.getClient())); } - /** Configures endpoint proxy support */ - public ContainerResource withEndpointProxySupport(boolean proxyEnabled) { + /** Sets a child relationship */ + public TestVaultResource withChildRelationship(IResource child) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("proxyEnabled", AspireClient.serializeValue(proxyEnabled)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withEndpointProxySupport", reqArgs); + reqArgs.put("child", AspireClient.serializeValue(child)); + getClient().invokeCapability("Aspire.Hosting/withChildRelationship", reqArgs); + return this; } - /** Sets the base image for a Dockerfile build */ - public IResource withDockerfileBaseImage(String buildImage, String runtimeImage) { + public TestVaultResource withChildRelationship(ResourceBuilderBase child) { + return withChildRelationship(new IResource(child.getHandle(), child.getClient())); + } + + public TestVaultResource withIconName(String iconName) { + return withIconName(iconName, null); + } + + /** Sets the icon for the resource */ + public TestVaultResource withIconName(String iconName, IconVariant iconVariant) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (buildImage != null) { - reqArgs.put("buildImage", AspireClient.serializeValue(buildImage)); - } - if (runtimeImage != null) { - reqArgs.put("runtimeImage", AspireClient.serializeValue(runtimeImage)); + reqArgs.put("iconName", AspireClient.serializeValue(iconName)); + if (iconVariant != null) { + reqArgs.put("iconVariant", AspireClient.serializeValue(iconVariant)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withDockerfileBaseImage", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withIconName", reqArgs); + return this; } - /** Adds a network alias for the container */ - public ContainerResource withContainerNetworkAlias(String alias) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("alias", AspireClient.serializeValue(alias)); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withContainerNetworkAlias", reqArgs); + /** Adds an HTTP health probe to the resource */ + public TestVaultResource withHttpProbe(ProbeType probeType, WithHttpProbeOptions options) { + var path = options == null ? null : options.getPath(); + var initialDelaySeconds = options == null ? null : options.getInitialDelaySeconds(); + var periodSeconds = options == null ? null : options.getPeriodSeconds(); + var timeoutSeconds = options == null ? null : options.getTimeoutSeconds(); + var failureThreshold = options == null ? null : options.getFailureThreshold(); + var successThreshold = options == null ? null : options.getSuccessThreshold(); + var endpointName = options == null ? null : options.getEndpointName(); + return withHttpProbeImpl(probeType, path, initialDelaySeconds, periodSeconds, timeoutSeconds, failureThreshold, successThreshold, endpointName); } - /** Configures an MCP server endpoint on the resource */ - public IResourceWithEndpoints withMcpServer(String path, String endpointName) { + public TestVaultResource withHttpProbe(ProbeType probeType) { + return withHttpProbe(probeType, null); + } + + /** Adds an HTTP health probe to the resource */ + private TestVaultResource withHttpProbeImpl(ProbeType probeType, String path, Double initialDelaySeconds, Double periodSeconds, Double timeoutSeconds, Double failureThreshold, Double successThreshold, String endpointName) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + reqArgs.put("probeType", AspireClient.serializeValue(probeType)); if (path != null) { reqArgs.put("path", AspireClient.serializeValue(path)); } + if (initialDelaySeconds != null) { + reqArgs.put("initialDelaySeconds", AspireClient.serializeValue(initialDelaySeconds)); + } + if (periodSeconds != null) { + reqArgs.put("periodSeconds", AspireClient.serializeValue(periodSeconds)); + } + if (timeoutSeconds != null) { + reqArgs.put("timeoutSeconds", AspireClient.serializeValue(timeoutSeconds)); + } + if (failureThreshold != null) { + reqArgs.put("failureThreshold", AspireClient.serializeValue(failureThreshold)); + } + if (successThreshold != null) { + reqArgs.put("successThreshold", AspireClient.serializeValue(successThreshold)); + } if (endpointName != null) { reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withMcpServer", reqArgs); + getClient().invokeCapability("Aspire.Hosting/withHttpProbe", reqArgs); + return this; } - /** Configures OTLP telemetry export */ - public IResourceWithEnvironment withOtlpExporter() { + /** Excludes the resource from MCP server exposure */ + public TestVaultResource excludeFromMcp() { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withOtlpExporter", reqArgs); + getClient().invokeCapability("Aspire.Hosting/excludeFromMcp", reqArgs); + return this; } - /** Configures OTLP telemetry export with specific protocol */ - public IResourceWithEnvironment withOtlpExporterProtocol(OtlpProtocol protocol) { + /** Sets the remote image name for publishing */ + public TestVaultResource withRemoteImageName(String remoteImageName) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("protocol", AspireClient.serializeValue(protocol)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withOtlpExporterProtocol", reqArgs); + reqArgs.put("remoteImageName", AspireClient.serializeValue(remoteImageName)); + getClient().invokeCapability("Aspire.Hosting/withRemoteImageName", reqArgs); + return this; } - /** Publishes the resource as a connection string */ - public ContainerResource publishAsConnectionString() { + /** Sets the remote image tag for publishing */ + public TestVaultResource withRemoteImageTag(String remoteImageTag) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/publishAsConnectionString", reqArgs); + reqArgs.put("remoteImageTag", AspireClient.serializeValue(remoteImageTag)); + getClient().invokeCapability("Aspire.Hosting/withRemoteImageTag", reqArgs); + return this; } - /** Adds a required command dependency */ - public IResource withRequiredCommand(String command, String helpLink) { + /** Adds a pipeline step to the resource */ + public TestVaultResource withPipelineStepFactory(String stepName, AspireAction1 callback, WithPipelineStepFactoryOptions options) { + var dependsOn = options == null ? null : options.getDependsOn(); + var requiredBy = options == null ? null : options.getRequiredBy(); + var tags = options == null ? null : options.getTags(); + var description = options == null ? null : options.getDescription(); + return withPipelineStepFactoryImpl(stepName, callback, dependsOn, requiredBy, tags, description); + } + + public TestVaultResource withPipelineStepFactory(String stepName, AspireAction1 callback) { + return withPipelineStepFactory(stepName, callback, null); + } + + /** Adds a pipeline step to the resource */ + private TestVaultResource withPipelineStepFactoryImpl(String stepName, AspireAction1 callback, String[] dependsOn, String[] requiredBy, String[] tags, String description) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("command", AspireClient.serializeValue(command)); - if (helpLink != null) { - reqArgs.put("helpLink", AspireClient.serializeValue(helpLink)); + reqArgs.put("stepName", AspireClient.serializeValue(stepName)); + var callbackId = getClient().registerCallback(args -> { + var arg = (PipelineStepContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + if (dependsOn != null) { + reqArgs.put("dependsOn", AspireClient.serializeValue(dependsOn)); + } + if (requiredBy != null) { + reqArgs.put("requiredBy", AspireClient.serializeValue(requiredBy)); + } + if (tags != null) { + reqArgs.put("tags", AspireClient.serializeValue(tags)); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withRequiredCommand", reqArgs); + if (description != null) { + reqArgs.put("description", AspireClient.serializeValue(description)); + } + getClient().invokeCapability("Aspire.Hosting/withPipelineStepFactory", reqArgs); + return this; } - /** Sets an environment variable */ - public IResourceWithEnvironment withEnvironment(String name, String value) { + /** Configures pipeline step dependencies via an async callback */ + public TestVaultResource withPipelineConfigurationAsync(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironment", reqArgs); + var callbackId = getClient().registerCallback(args -> { + var arg = (PipelineConfigurationContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withPipelineConfigurationAsync", reqArgs); + return this; } - /** Adds an environment variable with a reference expression */ - public IResourceWithEnvironment withEnvironmentExpression(String name, ReferenceExpression value) { + /** Configures pipeline step dependencies via a callback */ + public TestVaultResource withPipelineConfiguration(AspireAction1 callback) { + Map reqArgs = new HashMap<>(); + reqArgs.put("builder", AspireClient.serializeValue(getHandle())); + var callbackId = getClient().registerCallback(args -> { + var obj = (PipelineConfigurationContext) args[0]; + callback.invoke(obj); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/withPipelineConfiguration", reqArgs); + return this; + } + + /** Adds a volume */ + public TestVaultResource withVolume(String target, WithVolumeOptions options) { + var name = options == null ? null : options.getName(); + var isReadOnly = options == null ? null : options.isReadOnly(); + return withVolumeImpl(target, name, isReadOnly); + } + + public TestVaultResource withVolume(String target) { + return withVolume(target, null); + } + + /** Adds a volume */ + private TestVaultResource withVolumeImpl(String target, String name, Boolean isReadOnly) { + Map reqArgs = new HashMap<>(); + reqArgs.put("resource", AspireClient.serializeValue(getHandle())); + reqArgs.put("target", AspireClient.serializeValue(target)); + if (name != null) { + reqArgs.put("name", AspireClient.serializeValue(name)); + } + if (isReadOnly != null) { + reqArgs.put("isReadOnly", AspireClient.serializeValue(isReadOnly)); + } + getClient().invokeCapability("Aspire.Hosting/withVolume", reqArgs); + return this; + } + + /** Gets the resource name */ + public String getResourceName() { + Map reqArgs = new HashMap<>(); + reqArgs.put("resource", AspireClient.serializeValue(getHandle())); + return (String) getClient().invokeCapability("Aspire.Hosting/getResourceName", reqArgs); + } + + /** Subscribes to the BeforeResourceStarted event */ + public TestVaultResource onBeforeResourceStarted(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentExpression", reqArgs); + var callbackId = getClient().registerCallback(args -> { + var arg = (BeforeResourceStartedEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onBeforeResourceStarted", reqArgs); + return this; } - /** Sets environment variables via callback */ - public IResourceWithEnvironment withEnvironmentCallback(Function callback) { + /** Subscribes to the ResourceStopped event */ + public TestVaultResource onResourceStopped(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceStoppedEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentCallback", reqArgs); + getClient().invokeCapability("Aspire.Hosting/onResourceStopped", reqArgs); + return this; } - /** Sets environment variables via async callback */ - public IResourceWithEnvironment withEnvironmentCallbackAsync(Function callback) { + /** Subscribes to the InitializeResource event */ + public TestVaultResource onInitializeResource(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var arg = (InitializeResourceEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentCallbackAsync", reqArgs); + getClient().invokeCapability("Aspire.Hosting/onInitializeResource", reqArgs); + return this; } - /** Sets an environment variable from an endpoint reference */ - public IResourceWithEnvironment withEnvironmentEndpoint(String name, EndpointReference endpointReference) { + /** Subscribes to the ResourceEndpointsAllocated event */ + public TestVaultResource onResourceEndpointsAllocated(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("endpointReference", AspireClient.serializeValue(endpointReference)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentEndpoint", reqArgs); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceEndpointsAllocatedEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onResourceEndpointsAllocated", reqArgs); + return this; } - /** Sets an environment variable from a parameter resource */ - public IResourceWithEnvironment withEnvironmentParameter(String name, ParameterResource parameter) { + /** Subscribes to the ResourceReady event */ + public TestVaultResource onResourceReady(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("parameter", AspireClient.serializeValue(parameter)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentParameter", reqArgs); + var callbackId = getClient().registerCallback(args -> { + var arg = (ResourceReadyEvent) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting/onResourceReady", reqArgs); + return this; } - /** Sets an environment variable from a connection string resource */ - public IResourceWithEnvironment withEnvironmentConnectionString(String envVarName, IResourceWithConnectionString resource) { + /** Adds an optional string parameter */ + public TestVaultResource withOptionalString(WithOptionalStringOptions options) { + var value = options == null ? null : options.getValue(); + var enabled = options == null ? null : options.getEnabled(); + return withOptionalStringImpl(value, enabled); + } + + public TestVaultResource withOptionalString() { + return withOptionalString(null); + } + + /** Adds an optional string parameter */ + private TestVaultResource withOptionalStringImpl(String value, Boolean enabled) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("envVarName", AspireClient.serializeValue(envVarName)); - reqArgs.put("resource", AspireClient.serializeValue(resource)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withEnvironmentConnectionString", reqArgs); + if (value != null) { + reqArgs.put("value", AspireClient.serializeValue(value)); + } + if (enabled != null) { + reqArgs.put("enabled", AspireClient.serializeValue(enabled)); + } + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalString", reqArgs); + return this; } - /** Adds arguments */ - public IResourceWithArgs withArgs(String[] args) { + /** Configures the resource with a DTO */ + public TestVaultResource withConfig(TestConfigDto config) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("args", AspireClient.serializeValue(args)); - return (IResourceWithArgs) getClient().invokeCapability("Aspire.Hosting/withArgs", reqArgs); + reqArgs.put("config", AspireClient.serializeValue(config)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConfig", reqArgs); + return this; } - /** Sets command-line arguments via callback */ - public IResourceWithArgs withArgsCallback(Function callback) { + /** Configures environment with callback (test version) */ + public TestVaultResource testWithEnvironmentCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var callbackId = getClient().registerCallback(args -> { + var arg = (TestEnvironmentContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); } - return (IResourceWithArgs) getClient().invokeCapability("Aspire.Hosting/withArgsCallback", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWithEnvironmentCallback", reqArgs); + return this; } - /** Sets command-line arguments via async callback */ - public IResourceWithArgs withArgsCallbackAsync(Function callback) { + /** Sets the created timestamp */ + public TestVaultResource withCreatedAt(String createdAt) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResourceWithArgs) getClient().invokeCapability("Aspire.Hosting/withArgsCallbackAsync", reqArgs); + reqArgs.put("createdAt", AspireClient.serializeValue(createdAt)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCreatedAt", reqArgs); + return this; } - /** Adds a reference to another resource */ - public IResourceWithEnvironment withReference(IResource source, String connectionName, Boolean optional, String name) { + /** Sets the modified timestamp */ + public TestVaultResource withModifiedAt(String modifiedAt) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("source", AspireClient.serializeValue(source)); - if (connectionName != null) { - reqArgs.put("connectionName", AspireClient.serializeValue(connectionName)); - } - if (optional != null) { - reqArgs.put("optional", AspireClient.serializeValue(optional)); - } - if (name != null) { - reqArgs.put("name", AspireClient.serializeValue(name)); - } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withReference", reqArgs); + reqArgs.put("modifiedAt", AspireClient.serializeValue(modifiedAt)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withModifiedAt", reqArgs); + return this; } - /** Adds a reference to a URI */ - public IResourceWithEnvironment withReferenceUri(String name, String uri) { + /** Sets the correlation ID */ + public TestVaultResource withCorrelationId(String correlationId) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("uri", AspireClient.serializeValue(uri)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withReferenceUri", reqArgs); + reqArgs.put("correlationId", AspireClient.serializeValue(correlationId)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCorrelationId", reqArgs); + return this; } - /** Adds a reference to an external service */ - public IResourceWithEnvironment withReferenceExternalService(ExternalServiceResource externalService) { + public TestVaultResource withOptionalCallback() { + return withOptionalCallback(null); + } + + /** Configures with optional callback */ + public TestVaultResource withOptionalCallback(AspireAction1 callback) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("externalService", AspireClient.serializeValue(externalService)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withReferenceExternalService", reqArgs); + var callbackId = callback == null ? null : getClient().registerCallback(args -> { + var arg = (TestCallbackContext) args[0]; + callback.invoke(arg); + return null; + }); + if (callbackId != null) { + reqArgs.put("callback", callbackId); + } + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalCallback", reqArgs); + return this; } - /** Adds a reference to an endpoint */ - public IResourceWithEnvironment withReferenceEndpoint(EndpointReference endpointReference) { + /** Sets the resource status */ + public TestVaultResource withStatus(TestResourceStatus status) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("endpointReference", AspireClient.serializeValue(endpointReference)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withReferenceEndpoint", reqArgs); + reqArgs.put("status", AspireClient.serializeValue(status)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withStatus", reqArgs); + return this; } - /** Adds a network endpoint */ - public IResourceWithEndpoints withEndpoint(Double port, Double targetPort, String scheme, String name, String env, Boolean isProxied, Boolean isExternal, ProtocolType protocol) { + /** Configures with nested DTO */ + public TestVaultResource withNestedConfig(TestNestedDto config) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (port != null) { - reqArgs.put("port", AspireClient.serializeValue(port)); - } - if (targetPort != null) { - reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); - } - if (scheme != null) { - reqArgs.put("scheme", AspireClient.serializeValue(scheme)); - } - if (name != null) { - reqArgs.put("name", AspireClient.serializeValue(name)); - } - if (env != null) { - reqArgs.put("env", AspireClient.serializeValue(env)); - } - if (isProxied != null) { - reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); - } - if (isExternal != null) { - reqArgs.put("isExternal", AspireClient.serializeValue(isExternal)); - } - if (protocol != null) { - reqArgs.put("protocol", AspireClient.serializeValue(protocol)); - } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withEndpoint", reqArgs); + reqArgs.put("config", AspireClient.serializeValue(config)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withNestedConfig", reqArgs); + return this; } - /** Adds an HTTP endpoint */ - public IResourceWithEndpoints withHttpEndpoint(Double port, Double targetPort, String name, String env, Boolean isProxied) { + /** Adds validation callback */ + public TestVaultResource withValidator(AspireFunc1 validator) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (port != null) { - reqArgs.put("port", AspireClient.serializeValue(port)); - } - if (targetPort != null) { - reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); - } - if (name != null) { - reqArgs.put("name", AspireClient.serializeValue(name)); - } - if (env != null) { - reqArgs.put("env", AspireClient.serializeValue(env)); - } - if (isProxied != null) { - reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); + var validatorId = getClient().registerCallback(args -> { + var arg = (TestResourceContext) args[0]; + return AspireClient.awaitValue(validator.invoke(arg)); + }); + if (validatorId != null) { + reqArgs.put("validator", validatorId); } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withHttpEndpoint", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withValidator", reqArgs); + return this; } - /** Adds an HTTPS endpoint */ - public IResourceWithEndpoints withHttpsEndpoint(Double port, Double targetPort, String name, String env, Boolean isProxied) { + /** Waits for another resource (test version) */ + public TestVaultResource testWaitFor(IResource dependency) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (port != null) { - reqArgs.put("port", AspireClient.serializeValue(port)); - } - if (targetPort != null) { - reqArgs.put("targetPort", AspireClient.serializeValue(targetPort)); - } - if (name != null) { - reqArgs.put("name", AspireClient.serializeValue(name)); - } - if (env != null) { - reqArgs.put("env", AspireClient.serializeValue(env)); - } - if (isProxied != null) { - reqArgs.put("isProxied", AspireClient.serializeValue(isProxied)); - } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withHttpsEndpoint", reqArgs); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWaitFor", reqArgs); + return this; } - /** Makes HTTP endpoints externally accessible */ - public IResourceWithEndpoints withExternalHttpEndpoints() { + public TestVaultResource testWaitFor(ResourceBuilderBase dependency) { + return testWaitFor(new IResource(dependency.getHandle(), dependency.getClient())); + } + + /** Adds a dependency on another resource */ + public TestVaultResource withDependency(IResourceWithConnectionString dependency) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withExternalHttpEndpoints", reqArgs); + reqArgs.put("dependency", AspireClient.serializeValue(dependency)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDependency", reqArgs); + return this; } - /** Gets an endpoint reference */ - public EndpointReference getEndpoint(String name) { + public TestVaultResource withDependency(ResourceBuilderBase dependency) { + return withDependency(new IResourceWithConnectionString(dependency.getHandle(), dependency.getClient())); + } + + /** Sets the endpoints */ + public TestVaultResource withEndpoints(String[] endpoints) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - return (EndpointReference) getClient().invokeCapability("Aspire.Hosting/getEndpoint", reqArgs); + reqArgs.put("endpoints", AspireClient.serializeValue(endpoints)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEndpoints", reqArgs); + return this; } - /** Configures resource for HTTP/2 */ - public IResourceWithEndpoints asHttp2Service() { + /** Sets environment variables */ + public TestVaultResource withEnvironmentVariables(Map variables) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/asHttp2Service", reqArgs); + reqArgs.put("variables", AspireClient.serializeValue(variables)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEnvironmentVariables", reqArgs); + return this; } - /** Customizes displayed URLs via callback */ - public IResource withUrlsCallback(Function callback) { + /** Performs a cancellable operation */ + public TestVaultResource withCancellableOperation(AspireAction1 operation) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); + var operationId = getClient().registerCallback(args -> { + var arg = CancellationToken.fromValue(args[0]); + operation.invoke(arg); + return null; + }); + if (operationId != null) { + reqArgs.put("operation", operationId); } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlsCallback", reqArgs); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCancellableOperation", reqArgs); + return this; } - /** Customizes displayed URLs via async callback */ - public IResource withUrlsCallbackAsync(Function callback) { + /** Configures vault using direct interface target */ + public TestVaultResource withVaultDirect(String option) { Map reqArgs = new HashMap<>(); reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlsCallbackAsync", reqArgs); + reqArgs.put("option", AspireClient.serializeValue(option)); + getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withVaultDirect", reqArgs); + return this; } - /** Adds or modifies displayed URLs */ - public IResource withUrl(String url, String displayText) { +} + +// ===== UpdateCommandStateContext.java ===== +// UpdateCommandStateContext.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.UpdateCommandStateContext. */ +public class UpdateCommandStateContext extends HandleWrapperBase { + UpdateCommandStateContext(Handle handle, AspireClient client) { + super(handle, client); + } + + /** Gets the ServiceProvider property */ + public IServiceProvider serviceProvider() { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("url", AspireClient.serializeValue(url)); - if (displayText != null) { - reqArgs.put("displayText", AspireClient.serializeValue(displayText)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrl", reqArgs); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + return (IServiceProvider) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/UpdateCommandStateContext.serviceProvider", reqArgs); } - /** Adds a URL using a reference expression */ - public IResource withUrlExpression(ReferenceExpression url, String displayText) { + /** Sets the ServiceProvider property */ + public UpdateCommandStateContext setServiceProvider(IServiceProvider value) { Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("url", AspireClient.serializeValue(url)); - if (displayText != null) { - reqArgs.put("displayText", AspireClient.serializeValue(displayText)); + reqArgs.put("context", AspireClient.serializeValue(getHandle())); + reqArgs.put("value", AspireClient.serializeValue(value)); + return (UpdateCommandStateContext) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/UpdateCommandStateContext.setServiceProvider", reqArgs); + } + + public UpdateCommandStateContext setServiceProvider(HandleWrapperBase value) { + return setServiceProvider(new IServiceProvider(value.getHandle(), value.getClient())); + } + +} + +// ===== UrlDisplayLocation.java ===== +// UrlDisplayLocation.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** UrlDisplayLocation enum. */ +public enum UrlDisplayLocation implements WireValueEnum { + SUMMARY_AND_DETAILS("SummaryAndDetails"), + DETAILS_ONLY("DetailsOnly"); + + private final String value; + + UrlDisplayLocation(String value) { + this.value = value; + } + + public String getValue() { return value; } + + public static UrlDisplayLocation fromValue(String value) { + for (UrlDisplayLocation e : values()) { + if (e.value.equals(value)) return e; } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlExpression", reqArgs); + throw new IllegalArgumentException("Unknown value: " + value); } +} - /** Customizes the URL for a specific endpoint via callback */ - public IResource withUrlForEndpoint(String endpointName, Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); +// ===== WaitBehavior.java ===== +// WaitBehavior.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** WaitBehavior enum. */ +public enum WaitBehavior implements WireValueEnum { + WAIT_ON_RESOURCE_UNAVAILABLE("WaitOnResourceUnavailable"), + STOP_ON_RESOURCE_UNAVAILABLE("StopOnResourceUnavailable"); + + private final String value; + + WaitBehavior(String value) { + this.value = value; + } + + public String getValue() { return value; } + + public static WaitBehavior fromValue(String value) { + for (WaitBehavior e : values()) { + if (e.value.equals(value)) return e; } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withUrlForEndpoint", reqArgs); + throw new IllegalArgumentException("Unknown value: " + value); } +} + +// ===== WireValueEnum.java ===== +// WireValueEnum.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; + +/** + * Marker interface for generated enums that need a transport value distinct from Enum.name(). + */ +public interface WireValueEnum { + String getValue(); +} + +// ===== WithDataVolumeOptions.java ===== +// WithDataVolumeOptions.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Options for WithDataVolume. */ +public final class WithDataVolumeOptions { + private String name; + private Boolean isReadOnly; - /** Adds a URL for a specific endpoint via factory callback */ - public IResourceWithEndpoints withUrlForEndpointFactory(String endpointName, Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withUrlForEndpointFactory", reqArgs); + public String getName() { return name; } + public WithDataVolumeOptions name(String value) { + this.name = value; + return this; } - /** Excludes the resource from the deployment manifest */ - public IResource excludeFromManifest() { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/excludeFromManifest", reqArgs); + public Boolean isReadOnly() { return isReadOnly; } + public WithDataVolumeOptions isReadOnly(Boolean value) { + this.isReadOnly = value; + return this; } - /** Waits for another resource to be ready */ - public IResourceWithWaitSupport waitFor(IResource dependency) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitFor", reqArgs); - } +} - /** Waits for another resource with specific behavior */ - public IResourceWithWaitSupport waitForWithBehavior(IResource dependency, WaitBehavior waitBehavior) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - reqArgs.put("waitBehavior", AspireClient.serializeValue(waitBehavior)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForWithBehavior", reqArgs); - } +// ===== WithDockerfileBaseImageOptions.java ===== +// WithDockerfileBaseImageOptions.java - GENERATED CODE - DO NOT EDIT - /** Waits for another resource to start */ - public IResourceWithWaitSupport waitForStart(IResource dependency) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForStart", reqArgs); - } +package aspire; - /** Waits for another resource to start with specific behavior */ - public IResourceWithWaitSupport waitForStartWithBehavior(IResource dependency, WaitBehavior waitBehavior) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - reqArgs.put("waitBehavior", AspireClient.serializeValue(waitBehavior)); - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForStartWithBehavior", reqArgs); - } +import java.util.*; +import java.util.function.*; - /** Prevents resource from starting automatically */ - public IResource withExplicitStart() { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withExplicitStart", reqArgs); - } +/** Options for WithDockerfileBaseImage. */ +public final class WithDockerfileBaseImageOptions { + private String buildImage; + private String runtimeImage; - /** Waits for resource completion */ - public IResourceWithWaitSupport waitForCompletion(IResource dependency, Double exitCode) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - if (exitCode != null) { - reqArgs.put("exitCode", AspireClient.serializeValue(exitCode)); - } - return (IResourceWithWaitSupport) getClient().invokeCapability("Aspire.Hosting/waitForCompletion", reqArgs); + public String getBuildImage() { return buildImage; } + public WithDockerfileBaseImageOptions buildImage(String value) { + this.buildImage = value; + return this; } - /** Adds a health check by key */ - public IResource withHealthCheck(String key) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("key", AspireClient.serializeValue(key)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withHealthCheck", reqArgs); + public String getRuntimeImage() { return runtimeImage; } + public WithDockerfileBaseImageOptions runtimeImage(String value) { + this.runtimeImage = value; + return this; } - /** Adds an HTTP health check */ - public IResourceWithEndpoints withHttpHealthCheck(String path, Double statusCode, String endpointName) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (path != null) { - reqArgs.put("path", AspireClient.serializeValue(path)); - } - if (statusCode != null) { - reqArgs.put("statusCode", AspireClient.serializeValue(statusCode)); - } - if (endpointName != null) { - reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); - } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withHttpHealthCheck", reqArgs); - } +} - /** Adds a resource command */ - public IResource withCommand(String name, String displayName, Function executeCommand, CommandOptions commandOptions) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("name", AspireClient.serializeValue(name)); - reqArgs.put("displayName", AspireClient.serializeValue(displayName)); - if (executeCommand != null) { - reqArgs.put("executeCommand", getClient().registerCallback(executeCommand)); - } - if (commandOptions != null) { - reqArgs.put("commandOptions", AspireClient.serializeValue(commandOptions)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withCommand", reqArgs); - } +// ===== WithDockerfileOptions.java ===== +// WithDockerfileOptions.java - GENERATED CODE - DO NOT EDIT - /** Configures developer certificate trust */ - public IResourceWithEnvironment withDeveloperCertificateTrust(boolean trust) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("trust", AspireClient.serializeValue(trust)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withDeveloperCertificateTrust", reqArgs); - } +package aspire; - /** Sets the certificate trust scope */ - public IResourceWithEnvironment withCertificateTrustScope(CertificateTrustScope scope) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("scope", AspireClient.serializeValue(scope)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withCertificateTrustScope", reqArgs); +import java.util.*; +import java.util.function.*; + +/** Options for WithDockerfile. */ +public final class WithDockerfileOptions { + private String dockerfilePath; + private String stage; + + public String getDockerfilePath() { return dockerfilePath; } + public WithDockerfileOptions dockerfilePath(String value) { + this.dockerfilePath = value; + return this; } - /** Configures HTTPS with a developer certificate */ - public IResourceWithEnvironment withHttpsDeveloperCertificate(ParameterResource password) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (password != null) { - reqArgs.put("password", AspireClient.serializeValue(password)); - } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withHttpsDeveloperCertificate", reqArgs); + public String getStage() { return stage; } + public WithDockerfileOptions stage(String value) { + this.stage = value; + return this; } - /** Removes HTTPS certificate configuration */ - public IResourceWithEnvironment withoutHttpsCertificate() { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting/withoutHttpsCertificate", reqArgs); +} + +// ===== WithEndpointOptions.java ===== +// WithEndpointOptions.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Options for WithEndpoint. */ +public final class WithEndpointOptions { + private Double port; + private Double targetPort; + private String scheme; + private String name; + private String env; + private Boolean isProxied; + private Boolean isExternal; + private ProtocolType protocol; + + public Double getPort() { return port; } + public WithEndpointOptions port(Double value) { + this.port = value; + return this; } - /** Sets the parent relationship */ - public IResource withParentRelationship(IResource parent) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("parent", AspireClient.serializeValue(parent)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withParentRelationship", reqArgs); + public Double getTargetPort() { return targetPort; } + public WithEndpointOptions targetPort(Double value) { + this.targetPort = value; + return this; } - /** Sets a child relationship */ - public IResource withChildRelationship(IResource child) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("child", AspireClient.serializeValue(child)); - return (IResource) getClient().invokeCapability("Aspire.Hosting/withChildRelationship", reqArgs); + public String getScheme() { return scheme; } + public WithEndpointOptions scheme(String value) { + this.scheme = value; + return this; } - /** Sets the icon for the resource */ - public IResource withIconName(String iconName, IconVariant iconVariant) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("iconName", AspireClient.serializeValue(iconName)); - if (iconVariant != null) { - reqArgs.put("iconVariant", AspireClient.serializeValue(iconVariant)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withIconName", reqArgs); + public String getName() { return name; } + public WithEndpointOptions name(String value) { + this.name = value; + return this; } - /** Adds an HTTP health probe to the resource */ - public IResourceWithEndpoints withHttpProbe(ProbeType probeType, String path, Double initialDelaySeconds, Double periodSeconds, Double timeoutSeconds, Double failureThreshold, Double successThreshold, String endpointName) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("probeType", AspireClient.serializeValue(probeType)); - if (path != null) { - reqArgs.put("path", AspireClient.serializeValue(path)); - } - if (initialDelaySeconds != null) { - reqArgs.put("initialDelaySeconds", AspireClient.serializeValue(initialDelaySeconds)); - } - if (periodSeconds != null) { - reqArgs.put("periodSeconds", AspireClient.serializeValue(periodSeconds)); - } - if (timeoutSeconds != null) { - reqArgs.put("timeoutSeconds", AspireClient.serializeValue(timeoutSeconds)); - } - if (failureThreshold != null) { - reqArgs.put("failureThreshold", AspireClient.serializeValue(failureThreshold)); - } - if (successThreshold != null) { - reqArgs.put("successThreshold", AspireClient.serializeValue(successThreshold)); - } - if (endpointName != null) { - reqArgs.put("endpointName", AspireClient.serializeValue(endpointName)); - } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/withHttpProbe", reqArgs); + public String getEnv() { return env; } + public WithEndpointOptions env(String value) { + this.env = value; + return this; } - /** Excludes the resource from MCP server exposure */ - public IResource excludeFromMcp() { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - return (IResource) getClient().invokeCapability("Aspire.Hosting/excludeFromMcp", reqArgs); + public Boolean isProxied() { return isProxied; } + public WithEndpointOptions isProxied(Boolean value) { + this.isProxied = value; + return this; } - /** Sets the remote image name for publishing */ - public IComputeResource withRemoteImageName(String remoteImageName) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("remoteImageName", AspireClient.serializeValue(remoteImageName)); - return (IComputeResource) getClient().invokeCapability("Aspire.Hosting/withRemoteImageName", reqArgs); + public Boolean isExternal() { return isExternal; } + public WithEndpointOptions isExternal(Boolean value) { + this.isExternal = value; + return this; } - /** Sets the remote image tag for publishing */ - public IComputeResource withRemoteImageTag(String remoteImageTag) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("remoteImageTag", AspireClient.serializeValue(remoteImageTag)); - return (IComputeResource) getClient().invokeCapability("Aspire.Hosting/withRemoteImageTag", reqArgs); + public ProtocolType getProtocol() { return protocol; } + public WithEndpointOptions protocol(ProtocolType value) { + this.protocol = value; + return this; } - /** Adds a pipeline step to the resource */ - public IResource withPipelineStepFactory(String stepName, Function callback, String[] dependsOn, String[] requiredBy, String[] tags, String description) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("stepName", AspireClient.serializeValue(stepName)); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - if (dependsOn != null) { - reqArgs.put("dependsOn", AspireClient.serializeValue(dependsOn)); - } - if (requiredBy != null) { - reqArgs.put("requiredBy", AspireClient.serializeValue(requiredBy)); - } - if (tags != null) { - reqArgs.put("tags", AspireClient.serializeValue(tags)); - } - if (description != null) { - reqArgs.put("description", AspireClient.serializeValue(description)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withPipelineStepFactory", reqArgs); +} + +// ===== WithExternalServiceHttpHealthCheckOptions.java ===== +// WithExternalServiceHttpHealthCheckOptions.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Options for WithExternalServiceHttpHealthCheck. */ +public final class WithExternalServiceHttpHealthCheckOptions { + private String path; + private Double statusCode; + + public String getPath() { return path; } + public WithExternalServiceHttpHealthCheckOptions path(String value) { + this.path = value; + return this; } - /** Configures pipeline step dependencies via an async callback */ - public IResource withPipelineConfigurationAsync(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withPipelineConfigurationAsync", reqArgs); + public Double getStatusCode() { return statusCode; } + public WithExternalServiceHttpHealthCheckOptions statusCode(Double value) { + this.statusCode = value; + return this; } - /** Configures pipeline step dependencies via a callback */ - public IResource withPipelineConfiguration(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/withPipelineConfiguration", reqArgs); +} + +// ===== WithHttpEndpointOptions.java ===== +// WithHttpEndpointOptions.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Options for WithHttpEndpoint. */ +public final class WithHttpEndpointOptions { + private Double port; + private Double targetPort; + private String name; + private String env; + private Boolean isProxied; + + public Double getPort() { return port; } + public WithHttpEndpointOptions port(Double value) { + this.port = value; + return this; } - /** Adds a volume */ - public ContainerResource withVolume(String target, String name, Boolean isReadOnly) { - Map reqArgs = new HashMap<>(); - reqArgs.put("resource", AspireClient.serializeValue(getHandle())); - reqArgs.put("target", AspireClient.serializeValue(target)); - if (name != null) { - reqArgs.put("name", AspireClient.serializeValue(name)); - } - if (isReadOnly != null) { - reqArgs.put("isReadOnly", AspireClient.serializeValue(isReadOnly)); - } - return (ContainerResource) getClient().invokeCapability("Aspire.Hosting/withVolume", reqArgs); + public Double getTargetPort() { return targetPort; } + public WithHttpEndpointOptions targetPort(Double value) { + this.targetPort = value; + return this; } - /** Gets the resource name */ - public String getResourceName() { - Map reqArgs = new HashMap<>(); - reqArgs.put("resource", AspireClient.serializeValue(getHandle())); - return (String) getClient().invokeCapability("Aspire.Hosting/getResourceName", reqArgs); + public String getName() { return name; } + public WithHttpEndpointOptions name(String value) { + this.name = value; + return this; } - /** Subscribes to the BeforeResourceStarted event */ - public IResource onBeforeResourceStarted(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onBeforeResourceStarted", reqArgs); + public String getEnv() { return env; } + public WithHttpEndpointOptions env(String value) { + this.env = value; + return this; } - /** Subscribes to the ResourceStopped event */ - public IResource onResourceStopped(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onResourceStopped", reqArgs); + public Boolean isProxied() { return isProxied; } + public WithHttpEndpointOptions isProxied(Boolean value) { + this.isProxied = value; + return this; } - /** Subscribes to the InitializeResource event */ - public IResource onInitializeResource(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onInitializeResource", reqArgs); +} + +// ===== WithHttpHealthCheckOptions.java ===== +// WithHttpHealthCheckOptions.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Options for WithHttpHealthCheck. */ +public final class WithHttpHealthCheckOptions { + private String path; + private Double statusCode; + private String endpointName; + + public String getPath() { return path; } + public WithHttpHealthCheckOptions path(String value) { + this.path = value; + return this; } - /** Subscribes to the ResourceEndpointsAllocated event */ - public IResourceWithEndpoints onResourceEndpointsAllocated(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResourceWithEndpoints) getClient().invokeCapability("Aspire.Hosting/onResourceEndpointsAllocated", reqArgs); + public Double getStatusCode() { return statusCode; } + public WithHttpHealthCheckOptions statusCode(Double value) { + this.statusCode = value; + return this; } - /** Subscribes to the ResourceReady event */ - public IResource onResourceReady(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting/onResourceReady", reqArgs); + public String getEndpointName() { return endpointName; } + public WithHttpHealthCheckOptions endpointName(String value) { + this.endpointName = value; + return this; } - /** Adds an optional string parameter */ - public IResource withOptionalString(String value, Boolean enabled) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (value != null) { - reqArgs.put("value", AspireClient.serializeValue(value)); - } - if (enabled != null) { - reqArgs.put("enabled", AspireClient.serializeValue(enabled)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalString", reqArgs); +} + +// ===== WithHttpProbeOptions.java ===== +// WithHttpProbeOptions.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Options for WithHttpProbe. */ +public final class WithHttpProbeOptions { + private String path; + private Double initialDelaySeconds; + private Double periodSeconds; + private Double timeoutSeconds; + private Double failureThreshold; + private Double successThreshold; + private String endpointName; + + public String getPath() { return path; } + public WithHttpProbeOptions path(String value) { + this.path = value; + return this; } - /** Configures the resource with a DTO */ - public IResource withConfig(TestConfigDto config) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("config", AspireClient.serializeValue(config)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withConfig", reqArgs); + public Double getInitialDelaySeconds() { return initialDelaySeconds; } + public WithHttpProbeOptions initialDelaySeconds(Double value) { + this.initialDelaySeconds = value; + return this; } - /** Configures environment with callback (test version) */ - public IResourceWithEnvironment testWithEnvironmentCallback(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWithEnvironmentCallback", reqArgs); + public Double getPeriodSeconds() { return periodSeconds; } + public WithHttpProbeOptions periodSeconds(Double value) { + this.periodSeconds = value; + return this; } - /** Sets the created timestamp */ - public IResource withCreatedAt(String createdAt) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("createdAt", AspireClient.serializeValue(createdAt)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCreatedAt", reqArgs); + public Double getTimeoutSeconds() { return timeoutSeconds; } + public WithHttpProbeOptions timeoutSeconds(Double value) { + this.timeoutSeconds = value; + return this; } - /** Sets the modified timestamp */ - public IResource withModifiedAt(String modifiedAt) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("modifiedAt", AspireClient.serializeValue(modifiedAt)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withModifiedAt", reqArgs); + public Double getFailureThreshold() { return failureThreshold; } + public WithHttpProbeOptions failureThreshold(Double value) { + this.failureThreshold = value; + return this; } - /** Sets the correlation ID */ - public IResource withCorrelationId(String correlationId) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("correlationId", AspireClient.serializeValue(correlationId)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCorrelationId", reqArgs); + public Double getSuccessThreshold() { return successThreshold; } + public WithHttpProbeOptions successThreshold(Double value) { + this.successThreshold = value; + return this; } - /** Configures with optional callback */ - public IResource withOptionalCallback(Function callback) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (callback != null) { - reqArgs.put("callback", getClient().registerCallback(callback)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withOptionalCallback", reqArgs); + public String getEndpointName() { return endpointName; } + public WithHttpProbeOptions endpointName(String value) { + this.endpointName = value; + return this; } - /** Sets the resource status */ - public IResource withStatus(TestResourceStatus status) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("status", AspireClient.serializeValue(status)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withStatus", reqArgs); +} + +// ===== WithHttpsEndpointOptions.java ===== +// WithHttpsEndpointOptions.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Options for WithHttpsEndpoint. */ +public final class WithHttpsEndpointOptions { + private Double port; + private Double targetPort; + private String name; + private String env; + private Boolean isProxied; + + public Double getPort() { return port; } + public WithHttpsEndpointOptions port(Double value) { + this.port = value; + return this; } - /** Configures with nested DTO */ - public IResource withNestedConfig(TestNestedDto config) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("config", AspireClient.serializeValue(config)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withNestedConfig", reqArgs); + public Double getTargetPort() { return targetPort; } + public WithHttpsEndpointOptions targetPort(Double value) { + this.targetPort = value; + return this; } - /** Adds validation callback */ - public IResource withValidator(Function validator) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (validator != null) { - reqArgs.put("validator", getClient().registerCallback(validator)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withValidator", reqArgs); + public String getName() { return name; } + public WithHttpsEndpointOptions name(String value) { + this.name = value; + return this; } - /** Waits for another resource (test version) */ - public IResource testWaitFor(IResource dependency) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/testWaitFor", reqArgs); + public String getEnv() { return env; } + public WithHttpsEndpointOptions env(String value) { + this.env = value; + return this; } - /** Adds a dependency on another resource */ - public IResource withDependency(IResourceWithConnectionString dependency) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("dependency", AspireClient.serializeValue(dependency)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withDependency", reqArgs); + public Boolean isProxied() { return isProxied; } + public WithHttpsEndpointOptions isProxied(Boolean value) { + this.isProxied = value; + return this; } - /** Sets the endpoints */ - public IResource withEndpoints(String[] endpoints) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("endpoints", AspireClient.serializeValue(endpoints)); - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEndpoints", reqArgs); +} + +// ===== WithMcpServerOptions.java ===== +// WithMcpServerOptions.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Options for WithMcpServer. */ +public final class WithMcpServerOptions { + private String path; + private String endpointName; + + public String getPath() { return path; } + public WithMcpServerOptions path(String value) { + this.path = value; + return this; } - /** Sets environment variables */ - public IResourceWithEnvironment withEnvironmentVariables(Map variables) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("variables", AspireClient.serializeValue(variables)); - return (IResourceWithEnvironment) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withEnvironmentVariables", reqArgs); + public String getEndpointName() { return endpointName; } + public WithMcpServerOptions endpointName(String value) { + this.endpointName = value; + return this; } - /** Performs a cancellable operation */ - public IResource withCancellableOperation(Function operation) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - if (operation != null) { - reqArgs.put("operation", getClient().registerCallback(operation)); - } - return (IResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withCancellableOperation", reqArgs); +} + +// ===== WithOptionalStringOptions.java ===== +// WithOptionalStringOptions.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Options for WithOptionalString. */ +public final class WithOptionalStringOptions { + private String value; + private Boolean enabled; + + public String getValue() { return value; } + public WithOptionalStringOptions value(String value) { + this.value = value; + return this; } - /** Configures vault using direct interface target */ - public ITestVaultResource withVaultDirect(String option) { - Map reqArgs = new HashMap<>(); - reqArgs.put("builder", AspireClient.serializeValue(getHandle())); - reqArgs.put("option", AspireClient.serializeValue(option)); - return (ITestVaultResource) getClient().invokeCapability("Aspire.Hosting.CodeGeneration.Java.Tests/withVaultDirect", reqArgs); + public Boolean getEnabled() { return enabled; } + public WithOptionalStringOptions enabled(Boolean value) { + this.enabled = value; + return this; } } -/** Wrapper for Aspire.Hosting/Aspire.Hosting.ApplicationModel.UpdateCommandStateContext. */ -class UpdateCommandStateContext extends HandleWrapperBase { - UpdateCommandStateContext(Handle handle, AspireClient client) { - super(handle, client); +// ===== WithPipelineStepFactoryOptions.java ===== +// WithPipelineStepFactoryOptions.java - GENERATED CODE - DO NOT EDIT + +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Options for WithPipelineStepFactory. */ +public final class WithPipelineStepFactoryOptions { + private String[] dependsOn; + private String[] requiredBy; + private String[] tags; + private String description; + + public String[] getDependsOn() { return dependsOn; } + public WithPipelineStepFactoryOptions dependsOn(String[] value) { + this.dependsOn = value; + return this; } - /** Gets the ServiceProvider property */ - public IServiceProvider serviceProvider() { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - return (IServiceProvider) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/UpdateCommandStateContext.serviceProvider", reqArgs); + public String[] getRequiredBy() { return requiredBy; } + public WithPipelineStepFactoryOptions requiredBy(String[] value) { + this.requiredBy = value; + return this; } - /** Sets the ServiceProvider property */ - public UpdateCommandStateContext setServiceProvider(IServiceProvider value) { - Map reqArgs = new HashMap<>(); - reqArgs.put("context", AspireClient.serializeValue(getHandle())); - reqArgs.put("value", AspireClient.serializeValue(value)); - return (UpdateCommandStateContext) getClient().invokeCapability("Aspire.Hosting.ApplicationModel/UpdateCommandStateContext.setServiceProvider", reqArgs); + public String[] getTags() { return tags; } + public WithPipelineStepFactoryOptions tags(String[] value) { + this.tags = value; + return this; + } + + public String getDescription() { return description; } + public WithPipelineStepFactoryOptions description(String value) { + this.description = value; + return this; } } -// ============================================================================ -// Handle wrapper registrations -// ============================================================================ +// ===== WithReferenceOptions.java ===== +// WithReferenceOptions.java - GENERATED CODE - DO NOT EDIT -/** Static initializer to register handle wrappers. */ -class AspireRegistrations { - static { - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.IDistributedApplicationBuilder", (h, c) -> new IDistributedApplicationBuilder(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.DistributedApplication", (h, c) -> new DistributedApplication(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReference", (h, c) -> new EndpointReference(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResource", (h, c) -> new IResource(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEnvironment", (h, c) -> new IResourceWithEnvironment(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithEndpoints", (h, c) -> new IResourceWithEndpoints(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithArgs", (h, c) -> new IResourceWithArgs(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithConnectionString", (h, c) -> new IResourceWithConnectionString(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithWaitSupport", (h, c) -> new IResourceWithWaitSupport(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.IResourceWithParent", (h, c) -> new IResourceWithParent(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerResource", (h, c) -> new ContainerResource(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecutableResource", (h, c) -> new ExecutableResource(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ProjectResource", (h, c) -> new ProjectResource(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ParameterResource", (h, c) -> new ParameterResource(h, c)); - AspireClient.registerHandleWrapper("System.ComponentModel/System.IServiceProvider", (h, c) -> new IServiceProvider(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceNotificationService", (h, c) -> new ResourceNotificationService(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceLoggerService", (h, c) -> new ResourceLoggerService(h, c)); - AspireClient.registerHandleWrapper("Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfiguration", (h, c) -> new IConfiguration(h, c)); - AspireClient.registerHandleWrapper("Microsoft.Extensions.Configuration.Abstractions/Microsoft.Extensions.Configuration.IConfigurationSection", (h, c) -> new IConfigurationSection(h, c)); - AspireClient.registerHandleWrapper("Microsoft.Extensions.Hosting.Abstractions/Microsoft.Extensions.Hosting.IHostEnvironment", (h, c) -> new IHostEnvironment(h, c)); - AspireClient.registerHandleWrapper("Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILogger", (h, c) -> new ILogger(h, c)); - AspireClient.registerHandleWrapper("Microsoft.Extensions.Logging.Abstractions/Microsoft.Extensions.Logging.ILoggerFactory", (h, c) -> new ILoggerFactory(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingStep", (h, c) -> new IReportingStep(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.Pipelines.IReportingTask", (h, c) -> new IReportingTask(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.Eventing.DistributedApplicationEventSubscription", (h, c) -> new DistributedApplicationEventSubscription(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContext", (h, c) -> new DistributedApplicationExecutionContext(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.DistributedApplicationExecutionContextOptions", (h, c) -> new DistributedApplicationExecutionContextOptions(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ProjectResourceOptions", (h, c) -> new ProjectResourceOptions(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.IUserSecretsManager", (h, c) -> new IUserSecretsManager(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineConfigurationContext", (h, c) -> new PipelineConfigurationContext(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineContext", (h, c) -> new PipelineContext(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStep", (h, c) -> new PipelineStep(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepContext", (h, c) -> new PipelineStepContext(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineStepFactoryContext", (h, c) -> new PipelineStepFactoryContext(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.Pipelines.PipelineSummary", (h, c) -> new PipelineSummary(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.Eventing.DistributedApplicationResourceEventSubscription", (h, c) -> new DistributedApplicationResourceEventSubscription(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEvent", (h, c) -> new IDistributedApplicationEvent(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationResourceEvent", (h, c) -> new IDistributedApplicationResourceEvent(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.Eventing.IDistributedApplicationEventing", (h, c) -> new IDistributedApplicationEventing(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.AfterResourcesCreatedEvent", (h, c) -> new AfterResourcesCreatedEvent(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeResourceStartedEvent", (h, c) -> new BeforeResourceStartedEvent(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.BeforeStartEvent", (h, c) -> new BeforeStartEvent(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.CommandLineArgsCallbackContext", (h, c) -> new CommandLineArgsCallbackContext(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ConnectionStringAvailableEvent", (h, c) -> new ConnectionStringAvailableEvent(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.DistributedApplicationModel", (h, c) -> new DistributedApplicationModel(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.EndpointReferenceExpression", (h, c) -> new EndpointReferenceExpression(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.EnvironmentCallbackContext", (h, c) -> new EnvironmentCallbackContext(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.InitializeResourceEvent", (h, c) -> new InitializeResourceEvent(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ReferenceExpressionBuilder", (h, c) -> new ReferenceExpressionBuilder(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.UpdateCommandStateContext", (h, c) -> new UpdateCommandStateContext(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ExecuteCommandContext", (h, c) -> new ExecuteCommandContext(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceEndpointsAllocatedEvent", (h, c) -> new ResourceEndpointsAllocatedEvent(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceReadyEvent", (h, c) -> new ResourceReadyEvent(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceStoppedEvent", (h, c) -> new ResourceStoppedEvent(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ResourceUrlsCallbackContext", (h, c) -> new ResourceUrlsCallbackContext(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ConnectionStringResource", (h, c) -> new ConnectionStringResource(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.ContainerRegistryResource", (h, c) -> new ContainerRegistryResource(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.DotnetToolResource", (h, c) -> new DotnetToolResource(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ExternalServiceResource", (h, c) -> new ExternalServiceResource(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.CSharpAppResource", (h, c) -> new CSharpAppResource(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.IResourceWithContainerFiles", (h, c) -> new IResourceWithContainerFiles(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestCallbackContext", (h, c) -> new TestCallbackContext(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestResourceContext", (h, c) -> new TestResourceContext(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestEnvironmentContext", (h, c) -> new TestEnvironmentContext(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestCollectionContext", (h, c) -> new TestCollectionContext(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestRedisResource", (h, c) -> new TestRedisResource(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestDatabaseResource", (h, c) -> new TestDatabaseResource(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.TestVaultResource", (h, c) -> new TestVaultResource(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting.CodeGeneration.Java.Tests/Aspire.Hosting.CodeGeneration.TypeScript.Tests.TestTypes.ITestVaultResource", (h, c) -> new ITestVaultResource(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.IContainerFilesDestinationResource", (h, c) -> new IContainerFilesDestinationResource(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Aspire.Hosting.ApplicationModel.IComputeResource", (h, c) -> new IComputeResource(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/List", (h, c) -> new AspireList(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Dict", (h, c) -> new AspireDict(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/List", (h, c) -> new AspireList(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Dict", (h, c) -> new AspireDict(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/List", (h, c) -> new AspireList(h, c)); - AspireClient.registerHandleWrapper("Aspire.Hosting/Dict", (h, c) -> new AspireDict(h, c)); +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Options for WithReference. */ +public final class WithReferenceOptions { + private String connectionName; + private Boolean optional; + private String name; + + public String getConnectionName() { return connectionName; } + public WithReferenceOptions connectionName(String value) { + this.connectionName = value; + return this; } - static void ensureRegistered() { - // Called to trigger static initializer + public Boolean getOptional() { return optional; } + public WithReferenceOptions optional(Boolean value) { + this.optional = value; + return this; + } + + public String getName() { return name; } + public WithReferenceOptions name(String value) { + this.name = value; + return this; } + } -// ============================================================================ -// Connection Helpers -// ============================================================================ +// ===== WithVolumeOptions.java ===== +// WithVolumeOptions.java - GENERATED CODE - DO NOT EDIT -/** Main entry point for Aspire SDK. */ -public class Aspire { - /** Connect to the AppHost server. */ - public static AspireClient connect() throws Exception { - AspireRegistrations.ensureRegistered(); - String socketPath = System.getenv("REMOTE_APP_HOST_SOCKET_PATH"); - if (socketPath == null || socketPath.isEmpty()) { - throw new RuntimeException("REMOTE_APP_HOST_SOCKET_PATH environment variable not set. Run this application using `aspire run`."); - } - AspireClient client = new AspireClient(socketPath); - client.connect(); - client.onDisconnect(() -> System.exit(1)); - return client; +package aspire; + +import java.util.*; +import java.util.function.*; + +/** Options for WithVolume. */ +public final class WithVolumeOptions { + private String name; + private Boolean isReadOnly; + + public String getName() { return name; } + public WithVolumeOptions name(String value) { + this.name = value; + return this; } - /** Create a new distributed application builder. */ - public static IDistributedApplicationBuilder createBuilder(CreateBuilderOptions options) throws Exception { - AspireClient client = connect(); - Map resolvedOptions = new HashMap<>(); - if (options != null) { - resolvedOptions.putAll(options.toMap()); - } - if (!resolvedOptions.containsKey("Args")) { - // Note: Java doesn't have easy access to command line args from here - resolvedOptions.put("Args", new String[0]); - } - if (!resolvedOptions.containsKey("ProjectDirectory")) { - resolvedOptions.put("ProjectDirectory", System.getProperty("user.dir")); - } - Map args = new HashMap<>(); - args.put("options", resolvedOptions); - return (IDistributedApplicationBuilder) client.invokeCapability("Aspire.Hosting/createBuilderWithOptions", args); + public Boolean isReadOnly() { return isReadOnly; } + public WithVolumeOptions isReadOnly(Boolean value) { + this.isReadOnly = value; + return this; } + } +// ===== sources.txt ===== +.modules/AddDockerfileOptions.java +.modules/AddParameterWithValueOptions.java +.modules/AfterResourcesCreatedEvent.java +.modules/Aspire.java +.modules/AspireAction0.java +.modules/AspireAction1.java +.modules/AspireAction2.java +.modules/AspireAction3.java +.modules/AspireAction4.java +.modules/AspireClient.java +.modules/AspireDict.java +.modules/AspireFunc0.java +.modules/AspireFunc1.java +.modules/AspireFunc2.java +.modules/AspireFunc3.java +.modules/AspireFunc4.java +.modules/AspireList.java +.modules/AspireRegistrations.java +.modules/AspireUnion.java +.modules/BaseRegistrations.java +.modules/BeforeResourceStartedEvent.java +.modules/BeforeStartEvent.java +.modules/CSharpAppResource.java +.modules/CancellationToken.java +.modules/CapabilityError.java +.modules/CertificateTrustScope.java +.modules/CommandLineArgsCallbackContext.java +.modules/CommandOptions.java +.modules/CompleteStepMarkdownOptions.java +.modules/CompleteStepOptions.java +.modules/CompleteTaskMarkdownOptions.java +.modules/CompleteTaskOptions.java +.modules/ConnectionStringAvailableEvent.java +.modules/ConnectionStringResource.java +.modules/ContainerLifetime.java +.modules/ContainerRegistryResource.java +.modules/ContainerResource.java +.modules/CreateBuilderOptions.java +.modules/DistributedApplication.java +.modules/DistributedApplicationEventSubscription.java +.modules/DistributedApplicationExecutionContext.java +.modules/DistributedApplicationExecutionContextOptions.java +.modules/DistributedApplicationModel.java +.modules/DistributedApplicationOperation.java +.modules/DistributedApplicationResourceEventSubscription.java +.modules/DotnetToolResource.java +.modules/EndpointProperty.java +.modules/EndpointReference.java +.modules/EndpointReferenceExpression.java +.modules/EnvironmentCallbackContext.java +.modules/ExecutableResource.java +.modules/ExecuteCommandContext.java +.modules/ExecuteCommandResult.java +.modules/ExternalServiceResource.java +.modules/Handle.java +.modules/HandleWrapperBase.java +.modules/IComputeResource.java +.modules/IConfiguration.java +.modules/IConfigurationSection.java +.modules/IContainerFilesDestinationResource.java +.modules/IDistributedApplicationBuilder.java +.modules/IDistributedApplicationEvent.java +.modules/IDistributedApplicationEventing.java +.modules/IDistributedApplicationResourceEvent.java +.modules/IHostEnvironment.java +.modules/ILogger.java +.modules/ILoggerFactory.java +.modules/IReportingStep.java +.modules/IReportingTask.java +.modules/IResource.java +.modules/IResourceWithArgs.java +.modules/IResourceWithConnectionString.java +.modules/IResourceWithContainerFiles.java +.modules/IResourceWithEndpoints.java +.modules/IResourceWithEnvironment.java +.modules/IResourceWithParent.java +.modules/IResourceWithWaitSupport.java +.modules/IServiceProvider.java +.modules/ITestVaultResource.java +.modules/IUserSecretsManager.java +.modules/IconVariant.java +.modules/ImagePullPolicy.java +.modules/InitializeResourceEvent.java +.modules/OtlpProtocol.java +.modules/ParameterResource.java +.modules/PipelineConfigurationContext.java +.modules/PipelineContext.java +.modules/PipelineStep.java +.modules/PipelineStepContext.java +.modules/PipelineStepFactoryContext.java +.modules/PipelineSummary.java +.modules/ProbeType.java +.modules/ProjectResource.java +.modules/ProjectResourceOptions.java +.modules/ProtocolType.java +.modules/PublishResourceUpdateOptions.java +.modules/ReferenceExpression.java +.modules/ReferenceExpressionBuilder.java +.modules/ResourceBuilderBase.java +.modules/ResourceEndpointsAllocatedEvent.java +.modules/ResourceEventDto.java +.modules/ResourceLoggerService.java +.modules/ResourceNotificationService.java +.modules/ResourceReadyEvent.java +.modules/ResourceStoppedEvent.java +.modules/ResourceUrlAnnotation.java +.modules/ResourceUrlsCallbackContext.java +.modules/TestCallbackContext.java +.modules/TestCollectionContext.java +.modules/TestConfigDto.java +.modules/TestDatabaseResource.java +.modules/TestDeeplyNestedDto.java +.modules/TestEnvironmentContext.java +.modules/TestNestedDto.java +.modules/TestPersistenceMode.java +.modules/TestRedisResource.java +.modules/TestResourceContext.java +.modules/TestResourceStatus.java +.modules/TestVaultResource.java +.modules/UpdateCommandStateContext.java +.modules/UrlDisplayLocation.java +.modules/WaitBehavior.java +.modules/WireValueEnum.java +.modules/WithDataVolumeOptions.java +.modules/WithDockerfileBaseImageOptions.java +.modules/WithDockerfileOptions.java +.modules/WithEndpointOptions.java +.modules/WithExternalServiceHttpHealthCheckOptions.java +.modules/WithHttpEndpointOptions.java +.modules/WithHttpHealthCheckOptions.java +.modules/WithHttpProbeOptions.java +.modules/WithHttpsEndpointOptions.java +.modules/WithMcpServerOptions.java +.modules/WithOptionalStringOptions.java +.modules/WithPipelineStepFactoryOptions.java +.modules/WithReferenceOptions.java +.modules/WithVolumeOptions.java diff --git a/tests/Aspire.Hosting.CodeGeneration.Python.Tests/Snapshots/AtsGeneratedAspire.verified.py b/tests/Aspire.Hosting.CodeGeneration.Python.Tests/Snapshots/AtsGeneratedAspire.verified.py index d84dd4677a6..a4df166e4dd 100644 --- a/tests/Aspire.Hosting.CodeGeneration.Python.Tests/Snapshots/AtsGeneratedAspire.verified.py +++ b/tests/Aspire.Hosting.CodeGeneration.Python.Tests/Snapshots/AtsGeneratedAspire.verified.py @@ -735,8 +735,14 @@ def create_builder(options: Any | None = None) -> IDistributedApplicationBuilder resolved_options.update(options.to_dict()) elif isinstance(options, dict): resolved_options.update(options) - resolved_options.setdefault("Args", sys.argv[1:]) - resolved_options.setdefault("ProjectDirectory", os.environ.get("ASPIRE_PROJECT_DIRECTORY", os.getcwd())) + if resolved_options.get("Args") is None: + resolved_options["Args"] = sys.argv[1:] + if resolved_options.get("ProjectDirectory") is None: + resolved_options["ProjectDirectory"] = os.environ.get("ASPIRE_PROJECT_DIRECTORY", os.getcwd()) + apphost_file_path = os.environ.get("ASPIRE_APPHOST_FILEPATH") + if apphost_file_path: + if resolved_options.get("AppHostFilePath") is None: + resolved_options["AppHostFilePath"] = apphost_file_path result = client.invoke_capability("Aspire.Hosting/createBuilderWithOptions", {"options": resolved_options}) return result diff --git a/tests/Aspire.Hosting.CodeGeneration.Python.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.py b/tests/Aspire.Hosting.CodeGeneration.Python.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.py index 050a517d447..70071ae0171 100644 --- a/tests/Aspire.Hosting.CodeGeneration.Python.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.py +++ b/tests/Aspire.Hosting.CodeGeneration.Python.Tests/Snapshots/TwoPassScanningGeneratedAspire.verified.py @@ -8783,8 +8783,14 @@ def create_builder(options: Any | None = None) -> IDistributedApplicationBuilder resolved_options.update(options.to_dict()) elif isinstance(options, dict): resolved_options.update(options) - resolved_options.setdefault("Args", sys.argv[1:]) - resolved_options.setdefault("ProjectDirectory", os.environ.get("ASPIRE_PROJECT_DIRECTORY", os.getcwd())) + if resolved_options.get("Args") is None: + resolved_options["Args"] = sys.argv[1:] + if resolved_options.get("ProjectDirectory") is None: + resolved_options["ProjectDirectory"] = os.environ.get("ASPIRE_PROJECT_DIRECTORY", os.getcwd()) + apphost_file_path = os.environ.get("ASPIRE_APPHOST_FILEPATH") + if apphost_file_path: + if resolved_options.get("AppHostFilePath") is None: + resolved_options["AppHostFilePath"] = apphost_file_path result = client.invoke_capability("Aspire.Hosting/createBuilderWithOptions", {"options": resolved_options}) return result diff --git a/tests/Shared/Docker/Dockerfile.e2e b/tests/Shared/Docker/Dockerfile.e2e index 883ca5c8d68..4ce1c4f2e6a 100644 --- a/tests/Shared/Docker/Dockerfile.e2e +++ b/tests/Shared/Docker/Dockerfile.e2e @@ -1,7 +1,7 @@ # Multi-stage Dockerfile for Aspire E2E testing (.NET variant). # # Includes: .NET SDK 10.0, Docker CLI (via host socket mount), gh CLI, -# Node.js, Python, Aspire install scripts. +# Node.js, Python, Java, Aspire install scripts. # # Usage: # Local dev (build from source): @@ -70,6 +70,11 @@ RUN apt-get update -qq && \ apt-get install -y --no-install-recommends python3 python3-pip python3-venv && \ rm -rf /var/lib/apt/lists/* +# Install Java (needed for Java AppHost tests). +RUN apt-get update -qq && \ + apt-get install -y --no-install-recommends openjdk-21-jdk && \ + rm -rf /var/lib/apt/lists/* + # --- Aspire CLI setup --- # Copy the install scripts. @@ -98,4 +103,3 @@ ENV DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 ENV DOTNET_GENERATE_ASPNET_CERTIFICATE=false ENV ASPIRE_PLAYGROUND=true ENV TERM=xterm - diff --git a/tests/Shared/Docker/Dockerfile.e2e-polyglot b/tests/Shared/Docker/Dockerfile.e2e-polyglot-base similarity index 89% rename from tests/Shared/Docker/Dockerfile.e2e-polyglot rename to tests/Shared/Docker/Dockerfile.e2e-polyglot-base index e56a6c11a0c..f6e7d309d29 100644 --- a/tests/Shared/Docker/Dockerfile.e2e-polyglot +++ b/tests/Shared/Docker/Dockerfile.e2e-polyglot-base @@ -1,8 +1,8 @@ -# Multi-stage Dockerfile for Aspire E2E testing (polyglot variant). +# Multi-stage Dockerfile for Aspire E2E testing (polyglot base variant). # # Includes: Docker CLI (via host socket mount), gh CLI, -# Node.js, Python, Aspire install scripts. -# Does NOT include .NET SDK — for TypeScript-only AppHost tests. +# Node.js, Aspire install scripts. +# Does NOT include .NET SDK or Java. # # Usage: # Local dev (build from source): @@ -68,11 +68,6 @@ RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \ apt-get install -y --no-install-recommends nodejs && \ rm -rf /var/lib/apt/lists/* -# Install Python (needed for Python templates). -RUN apt-get update -qq && \ - apt-get install -y --no-install-recommends python3 python3-pip python3-venv && \ - rm -rf /var/lib/apt/lists/* - # --- Aspire CLI setup --- # Copy the install scripts. diff --git a/tests/Shared/Docker/Dockerfile.e2e-polyglot-java b/tests/Shared/Docker/Dockerfile.e2e-polyglot-java new file mode 100644 index 00000000000..b8daa3dbddd --- /dev/null +++ b/tests/Shared/Docker/Dockerfile.e2e-polyglot-java @@ -0,0 +1,8 @@ +# Polyglot Dockerfile for Java AppHost E2E tests. +# Extends the shared polyglot base with the JDK required by Java AppHosts. + +FROM aspire-e2e-polyglot-base + +RUN apt-get update -qq && \ + apt-get install -y --no-install-recommends openjdk-25-jdk && \ + rm -rf /var/lib/apt/lists/* diff --git a/tests/Shared/Hex1bAutomatorTestHelpers.cs b/tests/Shared/Hex1bAutomatorTestHelpers.cs index ffc9fa49d2a..758ed007834 100644 --- a/tests/Shared/Hex1bAutomatorTestHelpers.cs +++ b/tests/Shared/Hex1bAutomatorTestHelpers.cs @@ -240,6 +240,16 @@ await auto.WaitUntilAsync( await auto.EnterAsync(); break; + case AspireTemplate.JavaEmptyAppHost: + await auto.DownAsync(); + await auto.DownAsync(); + await auto.WaitUntilAsync( + s => new CellPatternSearcher().Find("> Empty (Java AppHost)").Search(s).Count > 0, + timeout: TimeSpan.FromSeconds(5), + description: "Java Empty AppHost template selected"); + await auto.EnterAsync(); + break; + default: throw new ArgumentOutOfRangeException(nameof(template), template, $"Unsupported template: {template}"); } diff --git a/tests/Shared/Hex1bTestHelpers.cs b/tests/Shared/Hex1bTestHelpers.cs index c85ead650ae..c8b9a4235b7 100644 --- a/tests/Shared/Hex1bTestHelpers.cs +++ b/tests/Shared/Hex1bTestHelpers.cs @@ -62,6 +62,12 @@ internal enum AspireTemplate /// Prompts: template, project name, output path, URLs. No language, Redis, or test project prompt. /// TypeScriptEmptyAppHost, + + /// + /// Empty (Java AppHost) — visible only when experimental Java support is enabled. + /// Prompts: template, project name, output path, URLs. No Redis or test project prompt. + /// + JavaEmptyAppHost, } ///