diff --git a/.github/skills/azsdk-common-generate-sdk-locally/SKILL.md b/.github/skills/azsdk-common-generate-sdk-locally/SKILL.md index a94df960ff4e8..d85ce366b3b5e 100644 --- a/.github/skills/azsdk-common-generate-sdk-locally/SKILL.md +++ b/.github/skills/azsdk-common-generate-sdk-locally/SKILL.md @@ -2,9 +2,9 @@ name: azsdk-common-generate-sdk-locally license: MIT metadata: - version: "1.1.0" + version: "1.1.1" distribution: shared -description: 'Generate, build, and test Azure SDKs locally from TypeSpec with automatic customization. WHEN: "generate SDK locally", "build SDK", "run SDK tests", "run CI checks", "validate package", "run checks", "update changelog", "fix SDK build errors", "fix breaking changes", "resolve SDK generation errors", "customize TypeSpec", "rename SDK client", "rename SDK model", "hide operation from SDK", "fix analyzer errors", "resolve customization drift", "create subclient", "update metadata", "update version". DO NOT USE FOR: publishing to package registries, CI pipeline configuration, API design review. INVOKES: azsdk_verify_setup, azsdk_package_generate_code, azsdk_package_build_code, azsdk_package_run_check, azsdk_package_run_tests, azsdk_customized_code_update, azsdk_package_update_changelog_content, azsdk_package_update_metadata, azsdk_package_update_version.' +description: 'Generate and finalize Azure SDKs locally from TypeSpec, including build, checks, tests, changelog, metadata, and version updates by default. WHEN: "generate SDK locally", "build SDK", "run SDK tests", "run CI checks", "validate package", "run checks", "update changelog", "fix SDK build errors", "resolve SDK generation errors", "customize TypeSpec", "rename SDK client", "rename SDK model", "hide operation from SDK", "fix analyzer errors", "resolve customization drift", "create subclient", "update metadata", "update version". INVOKES: azsdk_verify_setup, azsdk_package_generate_code, azsdk_package_build_code, azsdk_package_run_check, azsdk_package_run_tests, azsdk_customized_code_update, azsdk_package_update_changelog_content, azsdk_package_update_metadata, azsdk_package_update_version.' compatibility: "azure-sdk-mcp server, local azure-sdk-for-{language} clone, language build tools" --- @@ -14,12 +14,23 @@ This skill generates, builds, and tests Azure SDKs locally from TypeSpec with au ## Triggers -USE FOR: generate, build, and test Azure SDKs locally from TypeSpec with automatic customization; update changelog; fix SDK build errors; fix breaking changes; resolve SDK generation errors; customize TypeSpec; rename SDK client or model; hide operation from SDK; fix analyzer errors; resolve customization drift; create subclient; update metadata; update version -WHEN: "generate SDK locally", "build SDK", "run SDK tests", "update changelog", "fix SDK build errors", "fix breaking changes", "resolve SDK generation errors", "customize TypeSpec", "rename SDK client", "rename SDK model", "hide operation from SDK", "fix analyzer errors", "resolve customization drift", "create subclient", "update metadata", "update version" -DO NOT USE FOR: publishing to package registries, CI pipeline configuration, API design review +USE FOR: generate, build, and test Azure SDKs locally from TypeSpec with automatic customization; update changelog; fix SDK build errors; resolve SDK generation errors; customize TypeSpec; rename SDK client or model; hide operation from SDK; fix analyzer errors; resolve customization drift; create subclient; update metadata; update version +WHEN: "generate SDK locally", "build SDK", "run SDK tests", "update changelog", "fix SDK build errors", "resolve SDK generation errors", "customize TypeSpec", "rename SDK client", "rename SDK model", "hide operation from SDK", "fix analyzer errors", "resolve customization drift", "create subclient", "update metadata", "update version" + +## Boundaries + +Do not use this skill for: + +- Publishing SDK packages to package registries +- CI pipeline configuration +- API design review ## Rules +- Interpret **"generate SDK"** and **"generate SDK locally"** as requests for the complete workflow: generate, build, validate, test, update changelog, update metadata, and update version. Do not treat the word "generate" by itself as a generate-only request. +- Stop after generation and a successful build when the user explicitly says **"generate only"**, **"only generate"**, or otherwise explicitly asks to skip checks, tests, changelog, metadata, and version updates. Bind `only` to the generation action even when a target qualifier follows: **"generate SDK only for Web PubSub"** is a generate-only request scoped to Web PubSub. By contrast, **"generate the SDK for only the Web PubSub service"** scopes the complete workflow to one service. Once a request is classified as generate-only, do not prompt for a commit or run steps 8–11. If the user's intent is unclear, default to the complete workflow. +- This skill generates an SDK **locally** from a local clone. Use it to generate an SDK **only when the user indicates local generation** — they say "local"/"locally", or are working from a local clone. If the user asks to "generate SDK for **all languages**", to generate **for a release plan / release ID** (even a single language), to generate **without a local clone**, or wants SDK **pull requests created** for them, do **not** generate locally — use the `azsdk-common-generate-sdk-pipeline` skill, which runs the SDK generation pipeline for each language and produces the SDK pull requests. +- Never use `azure-sdk-mcp:azsdk_get_sdk_pull_request_link` or `azure-sdk-mcp:azsdk_get_pull_request` to _generate_ an SDK; those only retrieve links for SDKs that were already generated. - Requires the `azure-sdk-mcp` server for the MCP workflow; without MCP, use `npm exec --prefix eng/common/tsp-client -- tsp-client` CLI. - Verify the target language repo and the correct TypeSpec configuration file before generation. - After generation or customization, run the check and test steps before updating metadata or finalizing changes. @@ -49,8 +60,8 @@ Prerequisites: azure-sdk-mcp server must be running. Without MCP, use `npx tsp-c - From an SDK language repo: use path to `tsp-location.yaml`. 4. **Verify setup** — Run `azure-sdk-mcp:azsdk_verify_setup` to confirm environment. 5. **Generate** — Run `azure-sdk-mcp:azsdk_package_generate_code` with the config file path. -6. **Build** — Run `azure-sdk-mcp:azsdk_package_build_code`. If build succeeds, proceed to step 8. -7. **Customize** — If build fails, or if user requests SDK modifications, run `azure-sdk-mcp:azsdk_customized_code_update` with the build errors or user request. The tool handles the full workflow internally: it classifies the issue, applies TypeSpec decorators and/or code patches, regenerates the SDK, and builds — all in one call. See [customization workflow](references/customization-workflow.md). +6. **Build** — Run `azure-sdk-mcp:azsdk_package_build_code`. For .NET, use the `additionalArguments: "/p:RunApiCompat=false"` to skip API compatibility checks if user requests to skip API compatibility check. +7. **Customize** — If build fails, or if user requests SDK modifications, run `azure-sdk-mcp:azsdk_customized_code_update` with the build errors or user request. The tool handles the full workflow internally: it classifies the issue, applies TypeSpec decorators and/or code patches, regenerates the SDK, and builds — all in one call. See [customization workflow](references/customization-workflow.md). _(If the user requested "generate only", stop here — skip steps 8–11.)_ 8. **Commit checkpoint** — Prompt the user to commit generated changes before proceeding. See [commit checkpoint details](references/detailed-workflow.md). 9. **Validate** — Run `azure-sdk-mcp:azsdk_package_run_check` and `azure-sdk-mcp:azsdk_package_run_tests`. 10. **Metadata** — Run `azure-sdk-mcp:azsdk_package_update_changelog_content`, `azure-sdk-mcp:azsdk_package_update_metadata`, and `azure-sdk-mcp:azsdk_package_update_version`. _(Note: For .NET data plane, skip this step — metadata, changelog, and version updates are per-commit tasks, not part of the generate/build/test workflow.)_ @@ -70,7 +81,6 @@ Prerequisites: azure-sdk-mcp server must be running. Without MCP, use `npx tsp-c - "Build and test the Python SDK package" - "Run CI checks for my SDK package" - "Fix the SDK build errors on this PR" -- "The SDK generation has breaking changes, resolve them" - "Rename FooClient to BarClient for .NET" - "Hide the internal polling operation from the Python SDK" - "Fix .NET analyzer errors AZC0030 and AZC0012" @@ -83,6 +93,7 @@ Prerequisites: azure-sdk-mcp server must be running. Without MCP, use `npx tsp-c ## Troubleshooting +- For "generate SDK for all languages", pipeline-based generation, or when no local SDK clone exists, call `azure-sdk-mcp:azsdk_run_generate_sdk` instead of the local generate flow, and never substitute `azure-sdk-mcp:azsdk_get_sdk_pull_request_link` / `azure-sdk-mcp:azsdk_get_pull_request` for generation. - Run `azure-sdk-mcp:azsdk_verify_setup` to confirm MCP and tools. - If build fails with type conflicts, breaking changes, analyzer errors, or customization drift, use `azure-sdk-mcp:azsdk_customized_code_update` to apply customizations. - The customization tool uses a two-phase approach: TypeSpec decorators first (Phase A), then code repairs if needed (Phase B). diff --git a/.github/skills/azsdk-common-generate-sdk-locally/evals/eval.yaml b/.github/skills/azsdk-common-generate-sdk-locally/evals/eval.yaml index 5984e6c49f8a8..ca7f153a1cc71 100644 --- a/.github/skills/azsdk-common-generate-sdk-locally/evals/eval.yaml +++ b/.github/skills/azsdk-common-generate-sdk-locally/evals/eval.yaml @@ -26,6 +26,44 @@ stimuli: required: - name: azure-sdk-mcp-azsdk_verify_setup - name: azure-sdk-mcp-azsdk_package_generate_code + - name: azure-sdk-mcp-azsdk_package_build_code + - name: azure-sdk-mcp-azsdk_package_run_check + - name: azure-sdk-mcp-azsdk_package_run_tests + - name: azure-sdk-mcp-azsdk_package_update_changelog_content + - name: azure-sdk-mcp-azsdk_package_update_metadata + - name: azure-sdk-mcp-azsdk_package_update_version + + - name: sdk-local-generate-only-001 + prompt: "Generate only the Python SDK locally from my TypeSpec project at specification/compute/resource-manager/Microsoft.Compute/ComputeRP/tspconfig.yaml. My azure-sdk-for-python repo is at ~/repos/azure-sdk-for-python." + graders: + - type: tool-calls + config: + required: + - name: azure-sdk-mcp-azsdk_verify_setup + - name: azure-sdk-mcp-azsdk_package_generate_code + - name: azure-sdk-mcp-azsdk_package_build_code + disallowed: + - name: azure-sdk-mcp-azsdk_package_run_check + - name: azure-sdk-mcp-azsdk_package_run_tests + - name: azure-sdk-mcp-azsdk_package_update_changelog_content + - name: azure-sdk-mcp-azsdk_package_update_metadata + - name: azure-sdk-mcp-azsdk_package_update_version + + - name: sdk-local-generate-only-002 + prompt: "Only generate the Python SDK locally from my TypeSpec project at specification/compute/resource-manager/Microsoft.Compute/ComputeRP/tspconfig.yaml. My azure-sdk-for-python repo is at ~/repos/azure-sdk-for-python." + graders: + - type: tool-calls + config: + required: + - name: azure-sdk-mcp-azsdk_verify_setup + - name: azure-sdk-mcp-azsdk_package_generate_code + - name: azure-sdk-mcp-azsdk_package_build_code + disallowed: + - name: azure-sdk-mcp-azsdk_package_run_check + - name: azure-sdk-mcp-azsdk_package_run_tests + - name: azure-sdk-mcp-azsdk_package_update_changelog_content + - name: azure-sdk-mcp-azsdk_package_update_metadata + - name: azure-sdk-mcp-azsdk_package_update_version - name: sdk-local-negative-001 prompt: "I want to use the Azure DevOps pipeline to generate SDKs automatically and have PRs created for me. I don't want to set up local tools." diff --git a/.github/skills/azsdk-common-generate-sdk-locally/evals/trigger.eval.yaml b/.github/skills/azsdk-common-generate-sdk-locally/evals/trigger.eval.yaml new file mode 100644 index 0000000000000..2ebf85d897603 --- /dev/null +++ b/.github/skills/azsdk-common-generate-sdk-locally/evals/trigger.eval.yaml @@ -0,0 +1,34 @@ +name: azsdk-common-generate-sdk-locally-trigger-eval +description: Trigger tests for the azsdk-common-generate-sdk-locally skill +type: capability + +environment: azsdk-mcp-mock + +tags: + area: azsdk-common-generate-sdk-locally + type: ci-gate + +defaults: + runs: 1 + timeout: "90s" + model: gpt-5.6-sol + executor: copilot-sdk + +scoring: + threshold: 0.8 + +stimuli: + - name: trigger-generate-python-sdk-locally + prompt: "Generate the Python SDK locally from my TypeSpec project at specification/compute/resource-manager/Microsoft.Compute/ComputeRP/tspconfig.yaml." + graders: + - type: skill-invocation + config: + required: ["azsdk-common-generate-sdk-locally"] + + # Should NOT trigger + - name: anti-trigger-mitigate-breaking-change + prompt: "Fix the SDK breaking changes" + graders: + - type: skill-invocation + config: + disallowed: ["azsdk-common-generate-sdk-locally"] diff --git a/.github/skills/azsdk-common-sdk-breaking-change/SKILL.md b/.github/skills/azsdk-common-sdk-breaking-change/SKILL.md new file mode 100644 index 0000000000000..0884cc5b3664f --- /dev/null +++ b/.github/skills/azsdk-common-sdk-breaking-change/SKILL.md @@ -0,0 +1,51 @@ +--- +name: azsdk-common-sdk-breaking-change +license: MIT +metadata: + version: "1.0.0" + distribution: shared +description: 'Detect and mitigate SDK Breaking changes for an SDK package which is generated from TypeSpec. WHEN: "Detect SDK breaking changes for a service", "Detect SDK breaking changes for an SDK package", "Detect and mitigate SDK breaking changes for a service", "Detect and mitigate SDK breaking changes for an SDK package". INVOKES: skill: azsdk-common-generate-sdk-locally; MCP tools: azure-sdk-mcp:azsdk_customized_code_update, azure-sdk-mcp:azsdk_package_detect_breaking_change.' +compatibility: "azure-sdk-mcp server, local azure-sdk-for-{language} clone, language build tools" +--- + +# SDK Breaking Change Detection and Mitigation + +## MCP Tools + +| Tool | Purpose | +| ---------------------------------------------------- | --------------------------- | +| `azure-sdk-mcp:azsdk_customized_code_update` | Apply customizations | +| `azure-sdk-mcp:azsdk_package_detect_breaking_change` | Detect SDK breaking changes | + +Prerequisites: azure-sdk-mcp server must be running. + +## Steps + +1. **Select language** — First extract one or more target languages from the user's prompt. If the prompt specifies any target languages, use them without asking the user to confirm. If it does not specify a target language, prompt the user to choose one or more from this list, presented in exactly this order: Go, Java, JavaScript, Python, .NET. + +- For each selected language in step 1, execute steps 2 through 6 **one language at a time** — fully complete all steps for one language before starting the next. Process multiple selected languages in the same order they appear in the list above. + +2. Follow `azsdk-common-generate-sdk-locally` skill to generate SDK only. For .NET, require the preparatory build to disable API compatibility checks using additionalArguments: "/p:RunApiCompat=false". This is a requirement of this workflow: compatibility findings must reach the detection and user-selection steps rather than be automatically repaired during generation. +3. **Detect SDK breaking Changes** - Run `azure-sdk-mcp:azsdk_package_detect_breaking_change` +4. **Display detected breaking changes** — If step 3 fails, display the `ResponseError` message and stop processing the current language. If step 3 detects breaking changes, display a `## Detected Breaking Changes` title followed by a Markdown table. Include exactly one breaking change per row with these columns: `Breaking Change`, `Category`, and `Resolution`. Preserve the category and resolution returned by the detection tool; do not replace them with a summary. If no breaking changes are detected, report that result and stop processing the current language. +5. **Prompt the user to choose breaking changes to mitigate** — If the user requested detection only, stop processing the current language after displaying the results. Otherwise, present the list from step 3 as a multiple-choice selection. +6. **Mitigate selected SDK breaking changes** — If the user selects no changes in step 5, stop processing the current language. Otherwise, run `azure-sdk-mcp:azsdk_customized_code_update` for the selected changes with these parameters: + +- packagePath: The SDK package path +- customizationRequest: resolve the 'breakingChanges' chosen in step 5 +- tspProjectPath: the typespec project path +- editScope: Set this based on the repository where the skill is running. When running in the target SDK language repository, use `'CustomCode'`. When running in `azure-rest-api-specs`, use `'All'` if the target SDK language repository is also available as a local clone; otherwise, use `'SpecInputs'`. + +After step 6, begin the next iteration. If the customization modified TypeSpec, first repeat step 2 to regenerate the SDK; otherwise, resume at step 3. Then repeat steps 3 through 6. Run at most three detection-and-mitigation iterations per language, stopping earlier if no breaking changes remain or the user declines further mitigation. After the third mitigation, run step 3 once more to identify and report any remaining breaking changes, then stop without offering a fourth mitigation. + +## Examples + +- "Detect and mitigate SDK breaking changes for the service" +- "Detect SDK breaking changes for the service" +- "Detect SDK breaking changes for Go SDK package" +- "Detect and mitigate SDK breaking changes for Go SDK package" + +## Troubleshooting + +- Requires the `azure-sdk-mcp` server. If it is unavailable, direct the user to the [quick-start guide](https://github.com/Azure/azure-sdk-tools/blob/main/tools/azsdk-cli/Azure.Sdk.Tools.Cli/README.md#quick-start) to configure it before continuing. +- Requires a local clone of the target SDK repository. If unavailable, prompt the user to clone it before continuing. diff --git a/.github/skills/azsdk-common-sdk-breaking-change/evals/eval.yaml b/.github/skills/azsdk-common-sdk-breaking-change/evals/eval.yaml new file mode 100644 index 0000000000000..755922f2a4861 --- /dev/null +++ b/.github/skills/azsdk-common-sdk-breaking-change/evals/eval.yaml @@ -0,0 +1,41 @@ +name: azsdk-common-sdk-breaking-change-eval +description: tests for the azsdk-common-sdk-breaking-change skill +type: capability + +environment: azsdk-mcp + +tags: + area: azsdk-common-sdk-breaking-change + type: ci-gate + +defaults: + runs: 1 + timeout: "900s" + model: gpt-5.6-sol + executor: copilot-sdk + +scoring: + threshold: 0.8 + +stimuli: + - name: detect-sdk-breaking-changes-for-service-001 + prompt: "Detect and mitigate Go SDK breaking changes for the service webpubsub" + environment: + commands: + - git clone --filter=blob:none --sparse https://github.com/Azure/azure-sdk-for-go.git && cd azure-sdk-for-go && git sparse-checkout set eng documentation sdk/resourcemanager/webpubsub/armwebpubsub + - git clone --filter=blob:none --sparse https://github.com/Azure/azure-rest-api-specs.git && cd azure-rest-api-specs && git sparse-checkout set specification/webpubsub/resource-manager/Microsoft.SignalRService/SignalRService + - node -e "require('fs').copyFileSync('models.tsp', 'azure-rest-api-specs/specification/webpubsub/resource-manager/Microsoft.SignalRService/SignalRService/models.tsp')" + files: + - src: ../fixtures/detect-sdk-breaking-changes-for-service-001/models.tsp + dest: models.tsp + graders: + - type: skill-invocation + config: + required: + [ + "azsdk-common-sdk-breaking-change", + "azsdk-common-generate-sdk-locally", + ] + - type: tool-calls + config: + required: ["azure-sdk-mcp-azsdk_package_detect_breaking_change"] diff --git a/.github/skills/azsdk-common-sdk-breaking-change/evals/trigger.eval.yaml b/.github/skills/azsdk-common-sdk-breaking-change/evals/trigger.eval.yaml new file mode 100644 index 0000000000000..933bdcfb40f5e --- /dev/null +++ b/.github/skills/azsdk-common-sdk-breaking-change/evals/trigger.eval.yaml @@ -0,0 +1,26 @@ +name: azsdk-common-sdk-breaking-change-trigger-eval +description: Trigger tests for the azsdk-common-sdk-breaking-change skill +type: capability + +environment: azsdk-mcp-mock + +tags: + area: azsdk-common-sdk-breaking-change + type: ci-gate + +defaults: + runs: 1 + timeout: "90s" + model: gpt-5.6-sol + executor: copilot-sdk + +scoring: + threshold: 0.8 + +stimuli: + - name: trigger-detect-sdk-breaking-changes-for-service + prompt: "Detect and mitigate SDK breaking changes for the service webpubsub" + graders: + - type: skill-invocation + config: + required: ["azsdk-common-sdk-breaking-change"] diff --git a/.github/skills/azsdk-common-sdk-breaking-change/fixtures/detect-sdk-breaking-changes-for-service-001/models.tsp b/.github/skills/azsdk-common-sdk-breaking-change/fixtures/detect-sdk-breaking-changes-for-service-001/models.tsp new file mode 100644 index 0000000000000..f1aa8ec9af18d --- /dev/null +++ b/.github/skills/azsdk-common-sdk-breaking-change/fixtures/detect-sdk-breaking-changes-for-service-001/models.tsp @@ -0,0 +1,1668 @@ +import "@typespec/rest"; +import "@typespec/http"; +import "@typespec/versioning"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; + +using Azure.ResourceManager; +using TypeSpec.Versioning; + +namespace Microsoft.SignalRService; + +/** + * Optional tier of this particular SKU. 'Standard' or 'Free'. + * + * `Basic` is deprecated, use `Standard` instead. + */ +union WebPubSubSkuTier { + string, + + /** Free tier for WebPubSub service */ + Free: "Free", + + /** Basic tier for WebPubSub service (deprecated, use Standard instead) */ + Basic: "Basic", + + /** Standard tier for WebPubSub service */ + Standard: "Standard", + + /** Premium tier for WebPubSub service */ + Premium: "Premium", +} + +/** + * Provisioning state of the resource. + */ +union ProvisioningState { + string, + + /** Unknown provisioning state */ + Unknown: "Unknown", + + /** Resource successfully provisioned */ + Succeeded: "Succeeded", + + /** Resource provisioning failed */ + Failed: "Failed", + + /** Resource provisioning was canceled */ + Canceled: "Canceled", + + /** Resource provisioning is running */ + Running: "Running", + + /** Resource is being created */ + Creating: "Creating", + + /** Resource is being updated */ + Updating: "Updating", + + /** Resource is being deleted */ + Deleting: "Deleting", + + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Moving: "Moving", +} + +/** + * Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + */ +union PrivateLinkServiceConnectionStatus { + string, + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Pending: "Pending", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Approved: "Approved", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Rejected: "Rejected", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Disconnected: "Disconnected", +} + +/** + * The type of identity that created the resource. + */ +union CreatedByType { + string, + + /** The entity was created by a user. */ + User: "User", + + /** The entity was created by an application. */ + Application: "Application", + + /** The entity was created by a managed identity. */ + ManagedIdentity: "ManagedIdentity", + + /** The entity was created by a key. */ + Key: "Key", +} + +/** + * Status of the shared private link resource + */ +union SharedPrivateLinkResourceStatus { + string, + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Pending: "Pending", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Approved: "Approved", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Rejected: "Rejected", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Disconnected: "Disconnected", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Timeout: "Timeout", +} + +/** + * Azure Networking ACL Action. + */ +union ACLAction { + string, + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Allow: "Allow", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Deny: "Deny", +} + +/** + * The incoming request type to the service + */ +union WebPubSubRequestType { + string, + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + ClientConnection: "ClientConnection", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + ServerConnection: "ServerConnection", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + RESTAPI: "RESTAPI", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Trace: "Trace", +} + +#suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +union ClientConnectionCountRuleDiscriminator { + string, + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + ThrottleByJwtSignatureRule: "ThrottleByJwtSignatureRule", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + ThrottleByUserIdRule: "ThrottleByUserIdRule", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + ThrottleByJwtCustomClaimRule: "ThrottleByJwtCustomClaimRule", +} + +#suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +union ClientTrafficControlRuleDiscriminator { + string, + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + TrafficThrottleByJwtSignatureRule: "TrafficThrottleByJwtSignatureRule", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + TrafficThrottleByUserIdRule: "TrafficThrottleByUserIdRule", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + TrafficThrottleByJwtCustomClaimRule: "TrafficThrottleByJwtCustomClaimRule", +} + +/** + * The kind of the service + */ +union ServiceKind { + string, + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + WebPubSub: "WebPubSub", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + SocketIO: "SocketIO", +} + +/** + * Represents the identity type: systemAssigned, userAssigned, None + */ +union ManagedIdentityType { + string, + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + None: "None", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + SystemAssigned: "SystemAssigned", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + UserAssigned: "UserAssigned", +} + +/** + * Upstream auth type enum. + */ +union UpstreamAuthType { + string, + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + None: "None", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + ManagedIdentity: "ManagedIdentity", +} + +#suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +union EventListenerFilterDiscriminator { + string, + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + EventName: "EventName", +} + +#suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +union EventListenerEndpointDiscriminator { + string, + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + EventHub: "EventHub", +} + +/** + * The type of access key. + */ +union KeyType { + string, + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Primary: "Primary", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Secondary: "Secondary", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Salt: "Salt", +} + +/** + * The scale type applicable to the sku. + */ +union ScaleType { + string, + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + None: "None", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Manual: "Manual", + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + Automatic: "Automatic", +} + +/** + * REST API operation supported by resource provider. + */ +model Operation { + /** + * Name of the operation with format: {provider}/{resource}/{operation} + */ + name?: string; + + /** + * If the operation is a data action. (for data plane rbac) + */ + isDataAction?: boolean; + + /** + * The object that describes a operation. + */ + display?: OperationDisplay; + + /** + * Optional. The intended executor of the operation; governs the display of the operation in the RBAC UX and the audit logs UX. + */ + origin?: string; + + /** + * Extra Operation properties. + */ + properties?: OperationProperties; +} + +/** + * The object that describes a operation. + */ +model OperationDisplay { + /** + * Friendly name of the resource provider + */ + provider?: string; + + /** + * Resource type on which the operation is performed. + */ + resource?: string; + + /** + * The localized friendly name for the operation. + */ + operation?: string; + + /** + * The localized friendly description for the operation + */ + description?: string; +} + +/** + * Extra Operation properties. + */ +model OperationProperties { + /** + * An object that describes a specification. + */ + serviceSpecification?: ServiceSpecification; +} + +model OperationList is Azure.Core.Page; +/** + * An object that describes a specification. + */ +model ServiceSpecification { + /** + * Specifications of the Metrics for Azure Monitoring. + */ + @identifiers(#["name", "unit"]) + metricSpecifications?: MetricSpecification[]; + + /** + * Specifications of the Logs for Azure Monitoring. + */ + @identifiers(#["name"]) + logSpecifications?: LogSpecification[]; +} + +/** + * Specifications of the Metrics for Azure Monitoring. + */ +model MetricSpecification { + /** + * Name of the metric. + */ + name?: string; + + /** + * Localized friendly display name of the metric. + */ + displayName?: string; + + /** + * Localized friendly description of the metric. + */ + displayDescription?: string; + + /** + * The unit that makes sense for the metric. + */ + unit?: string; + + /** + * Only provide one value for this field. Valid values: Average, Minimum, Maximum, Total, Count. + */ + aggregationType?: string; + + /** + * Optional. If set to true, then zero will be returned for time duration where no metric is emitted/published. + * Ex. a metric that returns the number of times a particular error code was emitted. The error code may not appear + * often, instead of the RP publishing 0, Shoebox can auto fill in 0s for time periods where nothing was emitted. + */ + fillGapWithZero?: string; + + /** + * The name of the metric category that the metric belongs to. A metric can only belong to a single category. + */ + category?: string; + + /** + * The dimensions of the metrics. + */ + @identifiers(#["name"]) + dimensions?: Dimension[]; +} + +/** + * Specifications of the Dimension of metrics. + */ +model Dimension { + /** + * The public facing name of the dimension. + */ + name?: string; + + /** + * Localized friendly display name of the dimension. + */ + displayName?: string; + + /** + * Name of the dimension as it appears in MDM. + */ + internalName?: string; + + /** + * A Boolean flag indicating whether this dimension should be included for the shoebox export scenario. + */ + toBeExportedForShoebox?: boolean; +} + +/** + * Specifications of the Logs for Azure Monitoring. + */ +model LogSpecification { + /** + * Name of the log. + */ + name?: string; + + /** + * Localized friendly display name of the log. + */ + displayName?: string; +} + +/** + * Data POST-ed to the nameAvailability action + */ +model NameAvailabilityParameters { + /** + * The resource type. Can be "Microsoft.SignalRService/SignalR", "Microsoft.SignalRService/WebPubSub", "Microsoft.SignalRService/SignalR/replicas" or "Microsoft.SignalRService/WebPubSub/replicas" + */ + type: string; + + /** + * The resource name to validate. e.g."my-resource-name" + */ + name: string; +} + +/** + * Result of the request to check name availability. It contains a flag and possible reason of failure. + */ +model NameAvailability { + /** + * Indicates whether the name is available or not. + */ + nameAvailable?: boolean; + + /** + * The reason of the availability. Required if name is not available. + */ + reason?: string; + + /** + * The message of the operation. + */ + message?: string; +} + +/** + * Object that includes an array of the resource usages and a possible link for next set. + */ +#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model SignalRServiceUsageList is Azure.Core.Page; + +/** + * Object that describes a specific usage of the resources. + */ +#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model SignalRServiceUsage { + /** + * Fully qualified ARM resource id + */ + id?: string; + + /** + * Current value for the usage quota. + */ + currentValue?: int64; + + /** + * The maximum permitted value for the usage quota. If there is no limit, this value will be -1. + */ + limit?: int64; + + /** + * Localizable String object containing the name and a localized value. + */ + name?: SignalRServiceUsageName; + + /** + * Representing the units of the usage quota. Possible values are: Count, Bytes, Seconds, Percent, CountPerSecond, BytesPerSecond. + */ + unit?: string; +} + +/** + * Localizable String object containing the name and a localized value. + */ +#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model SignalRServiceUsageName { + /** + * The identifier of the usage. + */ + value?: string; + + /** + * Localized name of the usage. + */ + localizedValue?: string; +} + +/** + * Object that includes an array of resources and a possible link for next set. + */ +model WebPubSubResourceList is Azure.Core.Page; + +/** + * The billing information of the resource. + */ +model ResourceSku { + /** + * The name of the SKU. Required. + * + * Allowed values: Standard_S1, Free_F1, Premium_P1, Premium_P2 + */ + name: string; + + /** + * Optional tier of this particular SKU. 'Standard' or 'Free'. + * + * `Basic` is deprecated, use `Standard` instead. + */ + @renamedFrom(Versions.v2025_08_01_preview, "tier") + tierNew?: WebPubSubSkuTier; + + /** + * Not used. Retained for future use. + */ + @visibility(Lifecycle.Read) + size?: string; + + /** + * Not used. Retained for future use. + */ + @visibility(Lifecycle.Read) + family?: string; + + /** + * Optional, integer. The unit count of the resource. + * 1 for Free_F1/Standard_S1/Premium_P1, 100 for Premium_P2 by default. + * + * If present, following values are allowed: + * Free_F1: 1; + * Standard_S1: 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100; + * Premium_P1: 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100; + * Premium_P2: 100,200,300,400,500,600,700,800,900,1000; + */ + capacity?: int32; +} + +/** + * A class that describes the properties of the resource + */ +model WebPubSubProperties { + /** + * Provisioning state of the resource. + */ + @visibility(Lifecycle.Read) + provisioningState?: ProvisioningState; + + /** + * The publicly accessible IP of the resource. + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @visibility(Lifecycle.Read) + externalIP?: string; + + /** + * FQDN of the service instance. + */ + @visibility(Lifecycle.Read) + hostName?: string; + + /** + * The publicly accessible port of the resource which is designed for browser/client side usage. + */ + @visibility(Lifecycle.Read) + publicPort?: int32; + + /** + * The publicly accessible port of the resource which is designed for customer server side usage. + */ + @visibility(Lifecycle.Read) + serverPort?: int32; + + /** + * Version of the resource. Probably you need the same or higher version of client SDKs. + */ + @visibility(Lifecycle.Read) + version?: string; + + /** + * Private endpoint connections to the resource. + */ + @visibility(Lifecycle.Read) + @identifiers(#[]) + privateEndpointConnections?: PrivateEndpointConnection[]; + + /** + * The list of shared private link resources. + */ + @visibility(Lifecycle.Read) + @identifiers(#[]) + sharedPrivateLinkResources?: SharedPrivateLinkResource[]; + + /** + * TLS settings for the resource + */ + tls?: WebPubSubTlsSettings; + + /** + * Deprecated. + */ + @visibility(Lifecycle.Read) + hostNamePrefix?: string; + + /** + * Live trace configuration of a Microsoft.SignalRService resource. + */ + liveTraceConfiguration?: LiveTraceConfiguration; + + /** + * Resource log configuration of a Microsoft.SignalRService resource. + */ + resourceLogConfiguration?: ResourceLogConfiguration; + + /** + * Network ACLs for the resource + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + networkACLs?: WebPubSubNetworkACLs; + + /** + * Application firewall settings for the resource + */ + applicationFirewall?: ApplicationFirewallSettings; + + /** + * Enable or disable public network access. Default to "Enabled". + * When it's Enabled, network ACLs still apply. + * When it's Disabled, public network access is always disabled no matter what you set in network ACLs. + */ + #suppress "@azure-tools/typespec-azure-resource-manager/secret-prop" "TODO: Check if this is a secret and add @secret or update reason" + publicNetworkAccess?: string = "Enabled"; + + /** + * DisableLocalAuth + * Enable or disable local auth with AccessKey + * When set as true, connection with AccessKey=xxx won't work. + */ + disableLocalAuth?: boolean = false; + + /** + * DisableLocalAuth + * Enable or disable aad auth + * When set as true, connection with AuthType=aad won't work. + */ + disableAadAuth?: boolean = false; + + /** + * Enable or disable the regional endpoint. Default to "Enabled". + * When it's Disabled, new connections will not be routed to this endpoint, however existing connections will not be affected. + * This property is replica specific. Disable the regional endpoint without replica is not allowed. + */ + regionEndpointEnabled?: string = "Enabled"; + + /** + * Stop or start the resource. Default to "False". + * When it's true, the data plane of the resource is shutdown. + * When it's false, the data plane of the resource is started. + */ + resourceStopped?: string = "false"; + + /** + * SocketIO settings for the resource + */ + #suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + socketIO?: WebPubSubSocketIOSettings; +} + +/** + * Private endpoint connection properties + */ +model PrivateEndpointConnectionProperties { + /** + * Provisioning state of the resource. + */ + @visibility(Lifecycle.Read) + provisioningState?: ProvisioningState; + + /** + * Private endpoint + */ + privateEndpoint?: PrivateEndpoint; + + /** + * Group IDs + */ + @visibility(Lifecycle.Read) + groupIds?: string[]; + + /** + * Connection state of the private endpoint connection + */ + privateLinkServiceConnectionState?: PrivateLinkServiceConnectionState; +} + +/** + * Private endpoint + */ +model PrivateEndpoint { + /** + * Full qualified Id of the private endpoint + */ + id?: string; +} + +/** + * Connection state of the private endpoint connection + */ +model PrivateLinkServiceConnectionState { + /** + * Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + */ + status?: PrivateLinkServiceConnectionStatus; + + /** + * The reason for approval/rejection of the connection. + */ + description?: string; + + /** + * A message indicating if changes on the service provider require any updates on the consumer. + */ + actionsRequired?: string; +} + +/** + * Describes the properties of an existing Shared Private Link Resource + */ +model SharedPrivateLinkResourceProperties { + /** + * The group id from the provider of resource the shared private link resource is for + */ + groupId: string; + + /** + * The resource id of the resource the shared private link resource is for + */ + privateLinkResourceId: string; + + /** + * Provisioning state of the resource. + */ + @visibility(Lifecycle.Read) + provisioningState?: ProvisioningState; + + /** + * The request message for requesting approval of the shared private link resource + */ + requestMessage?: string; + + /** + * A list of FQDNs for third party private link service + */ + fqdns?: string[]; + + /** + * Status of the shared private link resource + */ + @visibility(Lifecycle.Read) + status?: SharedPrivateLinkResourceStatus; +} + +/** + * TLS settings for the resource + */ +model WebPubSubTlsSettings { + /** + * Request client certificate during TLS handshake if enabled. Not supported for free tier. Any input will be ignored for free tier. + */ + clientCertEnabled?: boolean = false; +} + +/** + * Live trace configuration of a Microsoft.SignalRService resource. + */ +model LiveTraceConfiguration { + /** + * Indicates whether or not enable live trace. + * When it's set to true, live trace client can connect to the service. + * Otherwise, live trace client can't connect to the service, so that you are unable to receive any log, no matter what you configure in "categories". + * Available values: true, false. + * Case insensitive. + */ + enabled?: string = "false"; + + /** + * Gets or sets the list of category configurations. + */ + @identifiers(#["name"]) + categories?: LiveTraceCategory[]; +} + +/** + * Live trace category configuration of a Microsoft.SignalRService resource. + */ +model LiveTraceCategory { + /** + * Gets or sets the live trace category's name. + * Available values: ConnectivityLogs, MessagingLogs. + * Case insensitive. + */ + name?: string; + + /** + * Indicates whether or the live trace category is enabled. + * Available values: true, false. + * Case insensitive. + */ + enabled?: string; +} + +/** + * Resource log configuration of a Microsoft.SignalRService resource. + */ +model ResourceLogConfiguration { + /** + * Gets or sets the list of category configurations. + */ + @identifiers(#["name"]) + categories?: ResourceLogCategory[]; +} + +/** + * Resource log category configuration of a Microsoft.SignalRService resource. + */ +model ResourceLogCategory { + /** + * Gets or sets the resource log category's name. + * Available values: ConnectivityLogs, MessagingLogs. + * Case insensitive. + */ + name?: string; + + /** + * Indicates whether or the resource log category is enabled. + * Available values: true, false. + * Case insensitive. + */ + enabled?: string; +} + +/** + * Network ACLs for the resource + */ +#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model WebPubSubNetworkACLs { + /** + * Azure Networking ACL Action. + */ + defaultAction?: ACLAction; + + /** + * Network ACL + */ + publicNetwork?: NetworkACL; + + /** + * ACLs for requests from private endpoints + */ + @identifiers(#["name"]) + privateEndpoints?: PrivateEndpointACL[]; + + /** + * IP rules for filtering public traffic + */ + @maxItems(30) + @identifiers(#[]) + ipRules?: IPRule[]; +} + +/** + * Network ACL + */ +#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model NetworkACL { + /** + * Allowed request types. The value can be one or more of: ClientConnection, ServerConnection, RESTAPI. + */ + allow?: WebPubSubRequestType[]; + + /** + * Denied request types. The value can be one or more of: ClientConnection, ServerConnection, RESTAPI. + */ + deny?: WebPubSubRequestType[]; +} + +/** + * ACL for a private endpoint + */ +#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model PrivateEndpointACL extends NetworkACL { + /** + * Name of the private endpoint connection + */ + name: string; +} + +/** + * An IP rule + */ +model IPRule { + /** + * An IP or CIDR or ServiceTag + */ + value?: string; + + /** + * Azure Networking ACL Action. + */ + action?: ACLAction; +} + +/** + * Application firewall settings for the resource + */ +model ApplicationFirewallSettings { + /** + * Rules to control the client connection count + */ + @maxItems(10) + @identifiers(#[]) + clientConnectionCountRules?: ClientConnectionCountRule[]; + + /** + * Rules to control the client traffic + */ + @maxItems(10) + @identifiers(#[]) + clientTrafficControlRules?: ClientTrafficControlRule[]; + + /** + * Config to control the client connection lifetime in seconds, can be set to 0 to disable the config + */ + @minValue(0) + @maxValue(604800) + maxClientConnectionLifetimeInSeconds?: int64; +} + +/** + * A base class for client connection count rules + */ +@discriminator("type") +model ClientConnectionCountRule { + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + type: ClientConnectionCountRuleDiscriminator; +} + +/** + * A base class for client traffic control rules + */ +@discriminator("type") +model ClientTrafficControlRule { + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + type: ClientTrafficControlRuleDiscriminator; +} + +/** + * SocketIO settings for the resource + */ +#suppress "@azure-tools/typespec-azure-core/casing-style" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model WebPubSubSocketIOSettings { + /** + * The service mode of Web PubSub for Socket.IO. Values allowed: + * "Default": have your own backend Socket.IO server + * "Serverless": your application doesn't have a backend server + */ + serviceMode?: string; +} + +/** + * A class represent managed identities used for request and response + */ +model ManagedIdentity { + /** + * Represents the identity type: systemAssigned, userAssigned, None + */ + type?: ManagedIdentityType; + + /** + * Get or set the user assigned identities + */ + #suppress "@azure-tools/typespec-azure-resource-manager/arm-no-record" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + userAssignedIdentities?: Record; + + /** + * Get the principal id for the system assigned identity. + * Only be used in response. + */ + @visibility(Lifecycle.Read) + principalId?: string; + + /** + * Get the tenant id for the system assigned identity. + * Only be used in response + */ + @visibility(Lifecycle.Read) + tenantId?: string; +} + +/** + * Properties of user assigned identity. + */ +model UserAssignedIdentityProperty { + /** + * Get the principal id for the user assigned identity + */ + @visibility(Lifecycle.Read) + principalId?: string; + + /** + * Get the client id for the user assigned identity + */ + @visibility(Lifecycle.Read) + clientId?: string; +} + +/** + * Custom certificates list. + */ +model CustomCertificateList is Azure.Core.Page; + +/** + * Custom certificate properties. + */ +model CustomCertificateProperties { + /** + * Provisioning state of the resource. + */ + @visibility(Lifecycle.Read) + provisioningState?: ProvisioningState; + + /** + * Base uri of the KeyVault that stores certificate. + */ + @visibility(Lifecycle.Read, Lifecycle.Create) + keyVaultBaseUri: string; + + /** + * Certificate secret name. + */ + @visibility(Lifecycle.Read, Lifecycle.Create) + keyVaultSecretName: string; + + /** + * Certificate secret version. + */ + @visibility(Lifecycle.Read, Lifecycle.Create) + keyVaultSecretVersion?: string; +} + +/** + * Custom domains list + */ +model CustomDomainList is Azure.Core.Page; + +/** + * Properties of a custom domain. + */ +model CustomDomainProperties { + /** + * Provisioning state of the resource. + */ + @visibility(Lifecycle.Read) + provisioningState?: ProvisioningState; + + /** + * The custom domain name. + */ + domainName: string; + + /** + * Reference to a resource. + */ + customCertificate: ResourceReference; +} + +/** + * Reference to a resource. + */ +model ResourceReference { + /** + * Resource ID. + */ + id?: string; +} + +/** + * Hub setting list + */ +model WebPubSubHubList is Azure.Core.Page; + +/** + * Properties of a hub. + */ +#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-provisioning-state" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model WebPubSubHubProperties { + /** + * Event handler of a hub. + */ + @identifiers(#[]) + eventHandlers?: EventHandler[]; + + /** + * Event listener settings for forwarding your client events to listeners. + * Event listener is transparent to Web PubSub clients, and it doesn't return any result to clients nor interrupt the lifetime of clients. + * One event can be sent to multiple listeners, as long as it matches the filters in those listeners. The order of the array elements doesn't matter. + * Maximum count of event listeners among all hubs is 10. + */ + @identifiers(#[]) + eventListeners?: EventListener[]; + + /** + * The settings for configuring if anonymous connections are allowed for this hub: "allow" or "deny". Default to "deny". + */ + anonymousConnectPolicy?: string = "deny"; + + /** + * The settings for configuring the WebSocket ping-pong interval in seconds for all clients in the hub. Valid range: 1 to 120. Default to 20 seconds. + */ + @maxValue(120) + @minValue(1) + webSocketKeepAliveIntervalInSeconds?: int32 = 20; + + /** + * The chat settings for the hub. + */ + @added(Versions.v2025_12_01_preview) + chat?: ChatSettings; +} + +/** + * Properties of event handler. + */ +model EventHandler { + @doc(""" + Gets or sets the URL template for the event handler. The actual URL is calculated when the corresponding event is triggered. + The template supports predefined parameters syntax: `{event}`, `{hub}`, and KeyVault reference syntax `{@Microsoft.KeyVault(SecretUri=_your_secret_identifier_)}` + For example, if the template is `http://example.com/api/{event}`, when `connect` event is triggered, a POST request will be sent to the URL `http://example.com/chat/api/connect`. + Note: Parameters are not allowed in the hostname of the URL, and curly brackets `{}` are reserved for parameter syntax only. If your URL path contains literal curly brackets, please URL-encode them to ensure proper handling. + """) + urlTemplate: string; + + /** + * Gets or sets the matching pattern for event names. + * There are 3 kinds of patterns supported: + * 1. "*", it matches any event name + * 2. Combine multiple events with ",", for example "event1,event2", it matches event "event1" and "event2" + * 3. A single event name, for example, "event1", it matches "event1" + */ + userEventPattern?: string; + + /** + * Gets or sets the list of system events. + */ + systemEvents?: string[]; + + /** + * Upstream auth settings. If not set, no auth is used for upstream messages. + */ + auth?: UpstreamAuthSettings; + + /** + * The group presence events that this event handler is concerned with. Group presence events are triggered when connections join or leave groups in the hub. If the value is null, no presence events will be sent to this event handler. + */ + @added(Versions.v2025_08_01_preview) + groupPresenceEvents?: GroupPresenceEventFilters; +} + +/** + * Represents presence event filters for event handler configuration. + */ +@added(Versions.v2025_08_01_preview) +model GroupPresenceEventFilters { + /** + * The concerning event names. Valid values are "joined", "left". If the value is null or empty, no presence events will be sent to the event handler. + */ + eventNames: GroupPresenceEventName[]; + + /** + * The group filters. Only events from these groups will be sent to the event handler. Each element is a pattern that may match multiple groups. If null or empty, events from all groups will be sent (subject to eventNames). + */ + groupFilters?: string[]; +} + +/** Allowed event names for group presence events. */ +@added(Versions.v2025_08_01_preview) +union GroupPresenceEventName { + /** Event triggered when a connection joins a group. */ + Joined: "joined", + + /** Event triggered when a connection leaves a group. */ + Left: "left", + + string, +} + +/** + * Upstream auth settings. If not set, no auth is used for upstream messages. + */ +model UpstreamAuthSettings { + /** + * Upstream auth type enum. + */ + type?: UpstreamAuthType; + + /** + * Managed identity settings for upstream. + */ + managedIdentity?: ManagedIdentitySettings; +} + +/** + * Managed identity settings for upstream. + */ +model ManagedIdentitySettings { + /** + * The Resource indicating the App ID URI of the target resource. + * It also appears in the aud (audience) claim of the issued token. + */ + resource?: string; +} + +/** + * A setting defines which kinds of events should be sent to which endpoint. + */ +model EventListener { + /** + * A base class for event filter which determines whether an event should be sent to an event listener. + */ + filter: EventListenerFilter; + + /** + * An endpoint specifying where Web PubSub should send events to. + */ + endpoint: EventListenerEndpoint; +} + +/** + * A base class for event filter which determines whether an event should be sent to an event listener. + */ +@discriminator("type") +model EventListenerFilter { + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + type: EventListenerFilterDiscriminator; +} + +/** + * An endpoint specifying where Web PubSub should send events to. + */ +@discriminator("type") +model EventListenerEndpoint { + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + type: EventListenerEndpointDiscriminator; +} + +/** + * Chat settings. + */ +model ChatSettings { + /** + * Enable or disable the chat feature. + */ + mode?: string; + + /** + * Reference to the the persistent storage for perisisting chat states. + */ + persistentStorage?: ResourceReference; +} + +/** + * A class represents the access keys of the resource. + */ +model WebPubSubKeys { + /** + * The primary access key. + */ + @secret + primaryKey?: string; + + /** + * The secondary access key. + */ + @secret + secondaryKey?: string; + + /** + * Connection string constructed via the primaryKey + */ + @secret + primaryConnectionString?: string; + + /** + * Connection string constructed via the secondaryKey + */ + @secret + secondaryConnectionString?: string; +} + +/** + * A list of private endpoint connections + */ +model PrivateEndpointConnectionList + is Azure.Core.Page; + +/** + * Contains a list of PrivateLinkResource and a possible link to query more results + */ +model PrivateLinkResourceList is Azure.Core.Page; + +/** + * Private link resource + */ +#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model PrivateLinkResource + extends Azure.ResourceManager.CommonTypes.ProxyResource { + /** + * Private link resource properties + */ + properties?: PrivateLinkResourceProperties; +} + +/** + * Private link resource properties + */ +model PrivateLinkResourceProperties { + /** + * Group Id of the private link resource + */ + groupId?: string; + + /** + * Required members of the private link resource + */ + requiredMembers?: string[]; + + /** + * Required private DNS zone names + */ + requiredZoneNames?: string[]; + + /** + * The list of resources that are onboarded to private link service + */ + @identifiers(#[]) + shareablePrivateLinkResourceTypes?: ShareablePrivateLinkResourceType[]; +} + +/** + * Describes a resource type that has been onboarded to private link service + */ +model ShareablePrivateLinkResourceType { + /** + * The name of the resource type that has been onboarded to private link service + */ + name?: string; + + /** + * Describes the properties of a resource type that has been onboarded to private link service + */ + properties?: ShareablePrivateLinkResourceProperties; +} + +/** + * Describes the properties of a resource type that has been onboarded to private link service + */ +model ShareablePrivateLinkResourceProperties { + /** + * The description of the resource type that has been onboarded to private link service + */ + description?: string; + + /** + * The resource provider group id for the resource that has been onboarded to private link service + */ + groupId?: string; + + /** + * The resource provider type for the resource that has been onboarded to private link service + */ + type?: string; +} + +/** + * Parameters describes the request to regenerate access keys + */ +model RegenerateKeyParameters { + /** + * The type of access key. + */ + keyType?: KeyType; +} + +#suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model ReplicaList is Azure.Core.Page; + +#suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" +model ReplicaProperties { + /** + * Provisioning state of the resource. + */ + @visibility(Lifecycle.Read) + provisioningState?: ProvisioningState; + + /** + * Enable or disable the regional endpoint. Default to "Enabled". + * When it's Disabled, new connections will not be routed to this endpoint, however existing connections will not be affected. + */ + regionEndpointEnabled?: string = "Enabled"; + + /** + * Stop or start the resource. Default to "false". + * When it's true, the data plane of the resource is shutdown. + * When it's false, the data plane of the resource is started. + */ + resourceStopped?: string = "false"; +} + +/** + * A list of shared private link resources + */ +model SharedPrivateLinkResourceList + is Azure.Core.Page; + +/** + * The list skus operation response + */ +model SkuList { + /** + * The list of skus available for the resource. + */ + @visibility(Lifecycle.Read) + @Azure.ResourceManager.identifiers(#[ + "resourceType", + "/sku/name", + "/sku/tier" + ]) + value?: Sku[]; + + /** + * The URL the client should use to fetch the next page (per server side paging). + * It's null for now, added for future use. + */ + @visibility(Lifecycle.Read) + nextLink?: string; +} + +/** + * Describes an available sku." + */ +model Sku { + /** + * The resource type that this object applies to + */ + @visibility(Lifecycle.Read) + resourceType?: string; + + /** + * The billing information of the resource. + */ + #suppress "@azure-tools/typespec-client-generator-core/property-name-conflict" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" + @visibility(Lifecycle.Read) + sku?: ResourceSku; + + /** + * Describes scaling information of a sku. + */ + @visibility(Lifecycle.Read) + capacity?: SkuCapacity; +} + +/** + * Describes scaling information of a sku. + */ +model SkuCapacity { + /** + * The lowest permitted capacity for this resource + */ + @visibility(Lifecycle.Read) + minimum?: int32; + + /** + * The highest permitted capacity for this resource + */ + @visibility(Lifecycle.Read) + maximum?: int32; + + /** + * The default capacity. + */ + @visibility(Lifecycle.Read) + default?: int32; + + /** + * Allows capacity value list. + */ + @visibility(Lifecycle.Read) + allowedValues?: int32[]; + + /** + * The scale type applicable to the sku. + */ + @visibility(Lifecycle.Read) + scaleType?: ScaleType; +} + +/** + * An Event Hub endpoint. + * The managed identity of Web PubSub service must be enabled, and the identity should have the "Azure Event Hubs Data sender" role to access Event Hub. + */ +model EventHubEndpoint extends EventListenerEndpoint { + /** + * The fully qualified namespace name of the Event Hub resource. + */ + fullyQualifiedNamespace: string; + + /** + * The name of the Event Hub. + */ + eventHubName: string; + + type: "EventHub"; +} + +/** + * Filter events by their name. + */ +model EventNameFilter extends EventListenerFilter { + /** + * Gets or sets a list of system events. Supported events: "connected" and "disconnected". Blocking event "connect" is not supported because it requires a response. + */ + systemEvents?: string[]; + + /** + * Gets or sets a matching pattern for event names. + * There are 3 kinds of patterns supported: + * 1. "*", it matches any event name + * 2. Combine multiple events with ",", for example "event1,event2", it matches events "event1" and "event2" + * 3. A single event name, for example, "event1", it matches "event1" + */ + userEventPattern?: string; + + type: "EventName"; +} + +/** + * Throttle the client connection by a custom JWT claim + */ +model ThrottleByJwtCustomClaimRule extends ClientConnectionCountRule { + /** + * The name of the claim in the JWT token. The client connection with the same claim value will be aggregated. If the claim is not found in the token, the connection will be allowed. + */ + claimName: string; + + /** + * Maximum connection count allowed for the same Jwt claim value. Clients with the same Jwt claim will get rejected if the connection count exceeds this value. Default value is 20. + */ + @minValue(0) + @maxValue(2147483647) + maxCount?: int32 = 20; + + type: "ThrottleByJwtCustomClaimRule"; +} + +/** + * Throttle the client connection by the JWT signature + */ +model ThrottleByJwtSignatureRule extends ClientConnectionCountRule { + /** + * Maximum connection count allowed for the same JWT signature. Clients with the same JWT signature will get rejected if the connection count exceeds this value. Default value is 20. + */ + @minValue(0) + @maxValue(2147483647) + maxCount?: int32 = 20; + + type: "ThrottleByJwtSignatureRule"; +} + +/** + * Throttle the client connection by the user ID + */ +model ThrottleByUserIdRule extends ClientConnectionCountRule { + /** + * Maximum connection count allowed for the same user ID. Clients with the same user ID will get rejected if the connection count exceeds this value. Default value is 20. + */ + @minValue(0) + @maxValue(2147483647) + maxCount?: int32 = 20; + + type: "ThrottleByUserIdRule"; +} + +/** + * Throttle the client traffic by a custom JWT claim + */ +model TrafficThrottleByJwtCustomClaimRule extends ClientTrafficControlRule { + /** + * The name of the claim in the JWT token. The message bytes with the same claim value will be aggregated. If the claim is not found in the token, the rule will be skipped. + */ + claimName: string; + + /** + * Maximum accumulated inbound message bytes allowed for the same JWT signature within a time window. Clients with the same JWT claim will get disconnected if the message bytes exceeds this value. Default value is 1GB. + */ + @minValue(0) + maxInboundMessageBytes?: int64; + + /** + * The aggregation window for the message bytes. The message bytes will be aggregated in this window and be reset after the window. Default value is 60 seconds. + */ + @maxValue(3600) + @minValue(10) + aggregationWindowInSeconds?: int32 = 60; + + type: "TrafficThrottleByJwtCustomClaimRule"; +} + +/** + * Throttle the client traffic by the JWT signature + */ +model TrafficThrottleByJwtSignatureRule extends ClientTrafficControlRule { + /** + * Maximum accumulated inbound message bytes allowed for the same JWT signature within a time window. Clients with the same JWT signature will get disconnected if the message bytes exceeds this value. Default value is 1GB. + */ + @minValue(0) + maxInboundMessageBytes?: int64; + + /** + * The aggregation window for the message bytes. The message bytes will be aggregated in this window and be reset after the window. Default value is 60 seconds. + */ + @maxValue(3600) + @minValue(10) + aggregationWindowInSeconds?: int32 = 60; + + type: "TrafficThrottleByJwtSignatureRule"; +} + +/** + * Throttle the client traffic by the user ID + */ +model TrafficThrottleByUserIdRule extends ClientTrafficControlRule { + /** + * Maximum accumulated inbound message bytes allowed for the same user ID within a time window. Clients with the same user ID will get disconnected if the message bytes exceeds this value. Default value is 1GB. + */ + @minValue(0) + maxInboundMessageBytes?: int64; + + /** + * The aggregation window for the message bytes. The message bytes will be aggregated in this window and be reset after the window. Default value is 60 seconds. + */ + @maxValue(3600) + @minValue(10) + aggregationWindowInSeconds?: int32 = 60; + + type: "TrafficThrottleByUserIdRule"; +} +@@identifiers(OperationList.value, #["name"]);